From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560777404; cv=none; d=zoho.com; s=zohoarc; b=EkLsdqbCKnQxPP+0V565LCkLiOFEjuBXWisl684TLdZQpohcqx9VjnJrc3Cr2o5Nu4yumEu1v/JdJ5IPdUMy1IV0ZnCCWV+PdludkO7PQ1sT9HkarlcTg+usrPORWNRxQKUBxfjfecXq8EVWpe5zPzgElBTnwN8nn2F/xVdU424= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560777404; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=LhEa+SCHvbeWWtylmbK5iAD2gg+ZmhdLicRg8KFAElw=; b=Y/DfVj9ZoAxNLUeZ2gJHJ5JNKGKILP6AOA9NioWC8XrB7vODAecJsw9TLV5rarMkMKy5C9elPT4CThwLTc/KLj2jxEx4/vhkZ3n381Y+ja7/g0/kP9TgbR5fNHbjxuV8zTae2hXTWBCJzJS7uqrmtffXzdtrCdy7mWlXJ5wCBZ0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560777404946164.31041837685336; Mon, 17 Jun 2019 06:16:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE3F130C31B6; Mon, 17 Jun 2019 13:16:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B2FCF348F6; Mon, 17 Jun 2019 13:16:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 69A24206D2; Mon, 17 Jun 2019 13:16:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCteAC024568 for ; Mon, 17 Jun 2019 08:55:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2E9C73781; Mon, 17 Jun 2019 12:55:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACFE189592 for ; Mon, 17 Jun 2019 12:55:37 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:26 +0200 Message-Id: <935eaecb0c0285fa05038a139656a32183787016.1560775960.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 1/9] docs: hvsupport: Add support for deprecating hypervisor implementations X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 17 Jun 2019 13:16:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Allow expressing that a hypervisor implementation was deleted by adding a end-version when the implementation was removed to our hypervisor support matrix. This patch hacks the perl scrip that generates the support matrix to support comments like: .domainQemuAttach =3D qemuDomainQemuAttach, /* 0.8.3 (deprecated: 5.5.0) */ Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/hvsupport.pl | 44 ++++++++++++++++++++++++++++++-------------- docs/libvirt.css | 4 ++++ 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl index a2b980c502..01026fc384 100755 --- a/docs/hvsupport.pl +++ b/docs/hvsupport.pl @@ -234,10 +234,11 @@ foreach my $src (@srcs) { } } else { - if ($line =3D~ m!\s*\.(\w+)\s*=3D\s*(\w+)\s*,?\s*(?:/\*\s*(\d+= \.\d+\.\d+)\s*\*/\s*)?$!) { + if ($line =3D~ m!\s*\.(\w+)\s*=3D\s*(\w+)\s*,?\s*(?:/\*\s*(\d+= \.\d+\.\d+)\s*(?:\(deprecated:\s*(\d+\.\d+\.\d+)\))?\s*\*/\s*)?$!) { my $api =3D $1; my $meth =3D $2; my $vers =3D $3; + my $depre =3D $4; next if $api eq "no" || $api eq "name"; @@ -251,12 +252,16 @@ foreach my $src (@srcs) { die "Found unexpected method $api in $ingrp\n"; } - $groups{$ingrp}->{drivers}->{$impl}->{$api} =3D $vers; + $groups{$ingrp}->{drivers}->{$impl}->{$api} =3D {}; + $groups{$ingrp}->{drivers}->{$impl}->{$api}->{vers} =3D $v= ers; + $groups{$ingrp}->{drivers}->{$impl}->{$api}->{depre} =3D = $depre; if ($api eq "domainMigratePrepare" || $api eq "domainMigratePrepare2" || $api eq "domainMigratePrepare3") { - $groups{$ingrp}->{drivers}->{$impl}->{"domainMigrate"}= =3D $vers - unless $groups{$ingrp}->{drivers}->{$impl}->{"doma= inMigrate"}; + if (!$groups{$ingrp}->{drivers}->{$impl}->{"domainMigr= ate"}) { + $groups{$ingrp}->{drivers}->{$impl}->{"domainMigra= te"} =3D {}; + $groups{$ingrp}->{drivers}->{$impl}->{"domainMigra= te"}->{vers} =3D $vers; + } } } elsif ($line =3D~ /}/) { @@ -280,7 +285,7 @@ $groups{virHypervisorDriver}->{apis}->{"domainMigrate"}= =3D "virDomainMigrate"; my $openAuthVers =3D (0 * 1000 * 1000) + (4 * 1000) + 0; foreach my $drv (keys %{$groups{"virHypervisorDriver"}->{drivers}}) { - my $openVersStr =3D $groups{"virHypervisorDriver"}->{drivers}->{$drv}-= >{"connectOpen"}; + my $openVersStr =3D $groups{"virHypervisorDriver"}->{drivers}->{$drv}-= >{"connectOpen"}->{"vers"}; my $openVers; if ($openVersStr =3D~ /(\d+)\.(\d+)\.(\d+)/) { $openVers =3D ($1 * 1000 * 1000) + ($2 * 1000) + $3; @@ -290,14 +295,16 @@ foreach my $drv (keys %{$groups{"virHypervisorDriver"= }->{drivers}}) { $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenReadOn= ly"} =3D $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpen"}; + $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAuth"}= =3D {}; + # virConnectOpenAuth is always 0.4.0 if the driver existed # before this time, otherwise it matches the version of # the driver's virConnectOpen entry if ($openVersStr eq "Y" || $openVers >=3D $openAuthVers) { - $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAu= th"} =3D $openVersStr; + $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAu= th"}->{vers} =3D $openVersStr; } else { - $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAu= th"} =3D "0.4.0"; + $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAu= th"}->{vers} =3D "0.4.0"; } } @@ -309,21 +316,23 @@ $groups{virHypervisorDriver}->{apis}->{"domainCreateL= inux"} =3D "virDomainCreateLi my $createAPIVers =3D (0 * 1000 * 1000) + (0 * 1000) + 3; foreach my $drv (keys %{$groups{"virHypervisorDriver"}->{drivers}}) { - my $createVersStr =3D $groups{"virHypervisorDriver"}->{drivers}->{$drv= }->{"domainCreateXML"}; + my $createVersStr =3D $groups{"virHypervisorDriver"}->{drivers}->{$drv= }->{"domainCreateXML"}->{"vers"}; next unless defined $createVersStr; my $createVers; if ($createVersStr =3D~ /(\d+)\.(\d+)\.(\d+)/) { $createVers =3D ($1 * 1000 * 1000) + ($2 * 1000) + $3; } + $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateLinux= "} =3D {}; + # virCreateLinux is always 0.0.3 if the driver existed # before this time, otherwise it matches the version of # the driver's virCreateXML entry if ($createVersStr eq "Y" || $createVers >=3D $createAPIVers) { - $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateL= inux"} =3D $createVersStr; + $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateL= inux"}->{vers} =3D $createVersStr; } else { - $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateL= inux"} =3D "0.0.3"; + $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateL= inux"}->{vers} =3D "0.0.3"; } } @@ -342,7 +351,8 @@ print < This page documents which libvirt calls work on which libvirt drivers / hypervisors, and which version the API appeared -in. +in. If a hypervisor deprecated the implementations the version when it +was removed is highlighted as this.

EOF @@ -395,11 +405,17 @@ EOF EOF foreach my $drv (sort {$a cmp $b } keys %{$groups{$grp}->{drivers}= }) { + print ""; + #print $groups{$grp}->{drivers}->{$drv}->{$field}; if (exists $groups{$grp}->{drivers}->{$drv}->{$field}) { - print "", $groups{$grp}->{drivers}->{$drv}->{$field}, = "\n"; - } else { - print "\n"; + if ($groups{$grp}->{drivers}->{$drv}->{$field}->{vers}) { + print $groups{$grp}->{drivers}->{$drv}->{$field}->{ver= s}; + } + if ($groups{$grp}->{drivers}->{$drv}->{$field}->{depre}) { + print " - ", $groups{$g= rp}->{drivers}->{$drv}->{$field}->{depre}, ""; + } } + print "\n"; } print < (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560777424281225.22380028002215; Mon, 17 Jun 2019 06:17:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6D8A830C0DFE; Mon, 17 Jun 2019 13:16:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 410FC8228F; Mon, 17 Jun 2019 13:16:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5EA0D1806B12; Mon, 17 Jun 2019 13:16:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCtex6024574 for ; Mon, 17 Jun 2019 08:55:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id EE26B179E8; Mon, 17 Jun 2019 12:55:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7959D3781 for ; Mon, 17 Jun 2019 12:55:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:27 +0200 Message-Id: <8ed587e85b55835301daa97bc0e69a7cb8349bf3.1560775960.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 2/9] qemu: driver: Drop support for qemu-attach X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 17 Jun 2019 13:16:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Attaching to modern qemu will not work with all this code and attempting to ressurect it would be mostly pointless. Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/check-aclrules.pl | 1 + src/qemu/qemu_driver.c | 92 ++++-------------------------------------- 2 files changed, 9 insertions(+), 84 deletions(-) diff --git a/src/check-aclrules.pl b/src/check-aclrules.pl index 23872cda98..be618f6c9f 100755 --- a/src/check-aclrules.pl +++ b/src/check-aclrules.pl @@ -61,6 +61,7 @@ my %whitelist =3D ( "interfaceClose" =3D> 1, "connectURIProbe" =3D> 1, "localOnly" =3D> 1, + "domainQemuAttach" =3D> 1, ); # XXX this vzDomainMigrateConfirm3Params looks diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f623eaa422..16652da9d4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16799,92 +16799,16 @@ static int qemuDomainQemuMonitorCommand(virDomain= Ptr domain, const char *cmd, } -static virDomainPtr qemuDomainQemuAttach(virConnectPtr conn, - unsigned int pid_value, - unsigned int flags) +static virDomainPtr +qemuDomainQemuAttach(virConnectPtr conn ATTRIBUTE_UNUSED, + unsigned int pid_value ATTRIBUTE_UNUSED, + unsigned int flags) { - virQEMUDriverPtr driver =3D conn->privateData; - virDomainObjPtr vm =3D NULL; - virDomainDefPtr def =3D NULL; - virDomainPtr dom =3D NULL; - virDomainChrSourceDefPtr monConfig =3D NULL; - bool monJSON =3D false; - pid_t pid =3D pid_value; - char *pidfile =3D NULL; - virQEMUCapsPtr qemuCaps =3D NULL; - virCapsPtr caps =3D NULL; - virCheckFlags(0, NULL); - if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; - - if (!(def =3D qemuParseCommandLinePid(driver->qemuCapsCache, - caps, driver->xmlopt, pid, - &pidfile, &monConfig, &monJSON))) - goto cleanup; - - if (virDomainQemuAttachEnsureACL(conn, def) < 0) - goto cleanup; - - if (!monConfig) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("No monitor connection for pid %u"), pid_value); - goto cleanup; - } - if (monConfig->type !=3D VIR_DOMAIN_CHR_TYPE_UNIX) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Cannot connect to monitor connection of type '%s= ' " - "for pid %u"), - virDomainChrTypeToString(monConfig->type), - pid_value); - goto cleanup; - } - - if (!(def->name) && - virAsprintf(&def->name, "attach-pid-%u", pid_value) < 0) - goto cleanup; - - if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, - def->emulator))) - goto cleanup; - - if (qemuAssignDeviceAliases(def, qemuCaps) < 0) - goto cleanup; - - if (!(vm =3D virDomainObjListAdd(driver->domains, def, - driver->xmlopt, - VIR_DOMAIN_OBJ_LIST_ADD_LIVE | - VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE, - NULL))) - goto cleanup; - - def =3D NULL; - - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) { - qemuDomainRemoveInactive(driver, vm); - goto cleanup; - } - - if (qemuProcessAttach(conn, driver, vm, pid, - pidfile, monConfig, monJSON) < 0) { - qemuDomainRemoveInactive(driver, vm); - qemuDomainObjEndJob(driver, vm); - goto cleanup; - } - - dom =3D virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); - - qemuDomainObjEndJob(driver, vm); - - cleanup: - virDomainDefFree(def); - virObjectUnref(monConfig); - virDomainObjEndAPI(&vm); - VIR_FREE(pidfile); - virObjectUnref(caps); - virObjectUnref(qemuCaps); - return dom; + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("attaching to a QEMU process started outside of libvi= rt is no longer supported")); + return NULL; } @@ -22459,7 +22383,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainRevertToSnapshot =3D qemuDomainRevertToSnapshot, /* 0.8.0 */ .domainSnapshotDelete =3D qemuDomainSnapshotDelete, /* 0.8.0 */ .domainQemuMonitorCommand =3D qemuDomainQemuMonitorCommand, /* 0.8.3 */ - .domainQemuAttach =3D qemuDomainQemuAttach, /* 0.9.4 */ + .domainQemuAttach =3D qemuDomainQemuAttach, /* 0.9.4 (deprecated: 5.5.= 0) */ .domainQemuAgentCommand =3D qemuDomainQemuAgentCommand, /* 0.10.0 */ .connectDomainQemuMonitorEventRegister =3D qemuConnectDomainQemuMonito= rEventRegister, /* 1.2.3 */ .connectDomainQemuMonitorEventDeregister =3D qemuConnectDomainQemuMoni= torEventDeregister, /* 1.2.3 */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560776201; cv=none; d=zoho.com; s=zohoarc; b=TrmzdlgrHNkPjztCeoElWt3PyYJB42yiM8tYZdQQ4DX8vDefsXJLYdV6zfeoiu5/YqMSzWXFsGmP0+WdGZEEvg7K6eoQB5e4WuLI+EoCvNgQj9FkTeh5RS0JUzVzC0Tfuld8Kqy0/Gqv61h6fRr194ZykTMC0MxorebTPrpF+5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560776201; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3p5PYuYfxZritpWDOz/ceLHdFz08Pr0ABxORG8iHa9E=; b=I1nUFjvYMzlQGId4lN2fS49IIek8w3S/CUa7el40Pn0//nP1YSoMlwR3rw1fppNEhck5OId5sDkFpH+5mJdEjMvAUUleY5HcnWOWPqYHkgA90Nkf9FxULhbzAvEwaS5DPmAJiN3TGXXfwS0Wxdp8zMAfSgPQfN2N3gvnkDHXMv0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560776201806850.6983088531977; Mon, 17 Jun 2019 05:56:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B6F9307D921; Mon, 17 Jun 2019 12:56:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 081F410027B8; Mon, 17 Jun 2019 12:56:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DCFA11806B16; Mon, 17 Jun 2019 12:55:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCtfiE024582 for ; Mon, 17 Jun 2019 08:55:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9629179E8; Mon, 17 Jun 2019 12:55:41 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 458663781 for ; Mon, 17 Jun 2019 12:55:41 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:28 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 3/9] qemu: parse: Drop qemuParseCommandLinePid and friends X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 17 Jun 2019 12:56:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that we no longer support attaching to a live non-libvirt qemu we can drop the backend functions as well. Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_parse_command.c | 92 ----------------------------------- src/qemu/qemu_parse_command.h | 7 --- 2 files changed, 99 deletions(-) diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index fc3f70fcde..b522882c78 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2767,95 +2767,3 @@ virDomainDefPtr qemuParseCommandLineString(virFileCa= chePtr capsCache, return def; } - - -static int qemuParseProcFileStrings(int pid_value, - const char *name, - char ***list) -{ - char *path =3D NULL; - int ret =3D -1; - char *data =3D NULL; - ssize_t len; - char *tmp; - size_t nstr =3D 0; - char **str =3D NULL; - - if (virAsprintf(&path, "/proc/%d/%s", pid_value, name) < 0) - goto cleanup; - - if ((len =3D virFileReadAll(path, 1024*128, &data)) < 0) - goto cleanup; - - tmp =3D data; - while (tmp < (data + len)) { - if (VIR_EXPAND_N(str, nstr, 1) < 0) - goto cleanup; - - if (VIR_STRDUP(str[nstr-1], tmp) < 0) - goto cleanup; - /* Skip arg */ - tmp +=3D strlen(tmp); - /* Skip \0 separator */ - tmp++; - } - - if (VIR_EXPAND_N(str, nstr, 1) < 0) - goto cleanup; - - str[nstr-1] =3D NULL; - - ret =3D nstr-1; - *list =3D str; - - cleanup: - if (ret < 0) - virStringListFree(str); - VIR_FREE(data); - VIR_FREE(path); - return ret; -} - -virDomainDefPtr qemuParseCommandLinePid(virFileCachePtr capsCache, - virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - pid_t pid, - char **pidfile, - virDomainChrSourceDefPtr *monConfi= g, - bool *monJSON) -{ - virDomainDefPtr def =3D NULL; - char **progargv =3D NULL; - char **progenv =3D NULL; - char *exepath =3D NULL; - char *emulator; - - /* The parser requires /proc/pid, which only exists on platforms - * like Linux where pid_t fits in int. */ - if ((int)pid !=3D pid || - qemuParseProcFileStrings(pid, "cmdline", &progargv) < 0 || - qemuParseProcFileStrings(pid, "environ", &progenv) < 0) - goto cleanup; - - if (!(def =3D qemuParseCommandLine(capsCache, caps, xmlopt, progenv, p= rogargv, - pidfile, monConfig, monJSON))) - goto cleanup; - - if (virAsprintf(&exepath, "/proc/%d/exe", (int)pid) < 0) - goto cleanup; - - if (virFileResolveLink(exepath, &emulator) < 0) { - virReportSystemError(errno, - _("Unable to resolve %s for pid %u"), - exepath, (int)pid); - goto cleanup; - } - VIR_FREE(def->emulator); - def->emulator =3D emulator; - - cleanup: - VIR_FREE(exepath); - virStringListFree(progargv); - virStringListFree(progenv); - return def; -} diff --git a/src/qemu/qemu_parse_command.h b/src/qemu/qemu_parse_command.h index 5eeb344c60..4dbb08fd59 100644 --- a/src/qemu/qemu_parse_command.h +++ b/src/qemu/qemu_parse_command.h @@ -37,13 +37,6 @@ virDomainDefPtr qemuParseCommandLineString(virFileCacheP= tr capsCache, char **pidfile, virDomainChrSourceDefPtr *monCo= nfig, bool *monJSON); -virDomainDefPtr qemuParseCommandLinePid(virFileCachePtr capsCache, - virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - pid_t pid, - char **pidfile, - virDomainChrSourceDefPtr *monConfi= g, - bool *monJSON); void qemuParseKeywordsFree(int nkeywords, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560777427; cv=none; d=zoho.com; s=zohoarc; b=GcSVHfKn844oBkpIO6iyBFx2qTlu/StXiWCiE/Kxelg3kd4li5BXUkjokUwNmlZB3PcKFWXOR9uDYwg3KRahPvu7yqmRyul7CELWOTX/MwiyOMdOF9plhQdIZah09NrPYfuLraEFY3pXMcDbxYodMRL8sRry3g0MQvINJyLrZtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560777427; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=XssjH0gH1oDoJ5u0DlJb0JNfuRxvOUjhz15xVFhVc3Q=; b=Eef/KcUOBt0fbyc8fpNjlI6QOlDl7Hb1ixdHheokHBQ9pVSZET5k4WG52YZsSaBS6tzuqdrE9lGs9Ql+q1sW9tKGOHvODXIXK04SAv7u7294+AGlPEiafXUuBtY5i1iAbsVUxtV4tShH9BwE3JPPHVKm3PnLTcW8ngo/HNyQG8A= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156077742740940.10347289440949; Mon, 17 Jun 2019 06:17:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47979C1EB211; Mon, 17 Jun 2019 13:17:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B99F6348F6; Mon, 17 Jun 2019 13:16:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 743121806B1A; Mon, 17 Jun 2019 13:16:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCtgLB024590 for ; Mon, 17 Jun 2019 08:55:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 84A49179E8; Mon, 17 Jun 2019 12:55:42 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10E703781 for ; Mon, 17 Jun 2019 12:55:41 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:29 +0200 Message-Id: <6a97cdd1a0128fbf4d95046914b75604a5a40cce.1560775960.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 4/9] qemu: driver: Remove support for native->XML conversion X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Jun 2019 13:17:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This code is really neglected and does not at all work reliably. It can't even be used for converting our own commandline back. Since this was mostly useful for aiding migration from manually run qemu to libvirt and will not work for this puspose in many cases it's not worth having. Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 46 +++++++++--------------------------------- 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 16652da9d4..afa18b15fd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -43,7 +43,6 @@ #include "qemu_conf.h" #include "qemu_capabilities.h" #include "qemu_command.h" -#include "qemu_parse_command.h" #include "qemu_cgroup.h" #include "qemu_hostdev.h" #include "qemu_hotplug.h" @@ -7318,45 +7317,20 @@ static char } -static char *qemuConnectDomainXMLFromNative(virConnectPtr conn, - const char *format, - const char *config, - unsigned int flags) +static char * +qemuConnectDomainXMLFromNative(virConnectPtr conn, + const char *format ATTRIBUTE_UNUSED, + const char *config ATTRIBUTE_UNUSED, + unsigned int flags) { - virQEMUDriverPtr driver =3D conn->privateData; - virDomainDefPtr def =3D NULL; - char *xml =3D NULL; - virCapsPtr caps =3D NULL; - virCheckFlags(0, NULL); if (virConnectDomainXMLFromNativeEnsureACL(conn) < 0) - goto cleanup; - - if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) { - virReportError(VIR_ERR_INVALID_ARG, - _("unsupported config type %s"), format); - goto cleanup; - } - - if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; - - def =3D qemuParseCommandLineString(driver->qemuCapsCache, - caps, driver->xmlopt, config, - NULL, NULL, NULL); - if (!def) - goto cleanup; - - if (!def->name && VIR_STRDUP(def->name, "unnamed") < 0) - goto cleanup; - - xml =3D qemuDomainDefFormatXML(driver, def, VIR_DOMAIN_XML_INACTIVE); + return NULL; - cleanup: - virDomainDefFree(def); - virObjectUnref(caps); - return xml; + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("converting arbitrary QEMU command lines to libvirt d= omain XML is no longer supported")); + return NULL; } static char *qemuConnectDomainXMLToNative(virConnectPtr conn, @@ -22298,7 +22272,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainGetSecurityLabelList =3D qemuDomainGetSecurityLabelList, /* 0.1= 0.0 */ .nodeGetSecurityModel =3D qemuNodeGetSecurityModel, /* 0.6.1 */ .domainGetXMLDesc =3D qemuDomainGetXMLDesc, /* 0.2.0 */ - .connectDomainXMLFromNative =3D qemuConnectDomainXMLFromNative, /* 0.6= .4 */ + .connectDomainXMLFromNative =3D qemuConnectDomainXMLFromNative, /* 0.6= .4 (deprecated: 5.5.0) */ .connectDomainXMLToNative =3D qemuConnectDomainXMLToNative, /* 0.6.4 */ .connectListDefinedDomains =3D qemuConnectListDefinedDomains, /* 0.2.0= */ .connectNumOfDefinedDomains =3D qemuConnectNumOfDefinedDomains, /* 0.2= .0 */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560777436; cv=none; d=zoho.com; s=zohoarc; b=CL3WyTfQi0vhENAGoCFa9T5TxzH2TtKPtyNAaI3RX9DtscbC1ZoKKJ1oRECJb+ZgLQ2nJEuH99cFjceCuDF+BSuBjTz4VtHP+mOPhvt8pX+7dE3y05V8BeEetCISr02NfjieNgovET4utb/xpQgSCmIjhvz13Dn5sQ6kRBKmzdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560777436; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=OnYEgmWQsBd0vHVDbG343OOceSQmrRk/0o9/Pe5XmoI=; b=gTF2alL+nQfAGfskMHwU19y7ghhCr3kXOYSzBoAlUofZDwaXz5PWGRireA5Uay2AR9ahVVktUVcYRK6VC7I4GsOOw5TDbMlXKBWzbCi+0rblHNdpZ1orAf9ec+vYsJqWbDsq13XvNBK3hMsQAZxaZAUHxcNY7ZTt8kFKWQw4XNc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560777436956526.6573611093212; Mon, 17 Jun 2019 06:17:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF4417FDF6; Mon, 17 Jun 2019 13:17:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EA7A5944E; Mon, 17 Jun 2019 13:17:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 59261206D3; Mon, 17 Jun 2019 13:17:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCth4o024595 for ; Mon, 17 Jun 2019 08:55:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 526BD3781; Mon, 17 Jun 2019 12:55:43 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1317179E8 for ; Mon, 17 Jun 2019 12:55:42 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:30 +0200 Message-Id: <3d2c9d888c9f088da555ff0922440864a6441a15.1560775960.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 5/9] news: Document removal of qemu commandline parsing X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 17 Jun 2019 13:17:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- docs/news.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index f95dfdf3b4..ff4f190c23 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -54,6 +54,18 @@
+
+ + + qemu: Remove support for virDomainQemuAttach and virConnectDomai= nXMLFromNative APIs + + + The qemu implementations for the APIs mentioned above were remov= ed + and the APIs now return error. The implementation was stale for a + long time and did not allow working with moder use of qemu in li= bvirt. + + +
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560776235; cv=none; d=zoho.com; s=zohoarc; b=XOu9FW0zGsmf/rFB733Y+bOYZuYoAKeJ7ttuPG78k0XmMMCBTkyIc7k8Y6A3+/luBpVPHXc/Mc0NGaa19T5/6FcmTIGiP/XRRjVnPi8GOE6aeSGc6a9RSqeeODWWgH6yGQbCvmb9cg+k+0l899+VIoUmH4T3X4uuAt+Ypw7fb7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560776235; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=R3Jaa0iCYNhx6ye6JwoKq/RQ+Vi1qihIV7VRizKvpw4=; b=MhqcLOVgGQyee+pg9ib55swr2IAO/475E0d2+Nd/cp90xd2INdpx4wnsofPIm7nBS03DYm8C4MDPGJoX7s6k9xbtK/iaJnLjbWqhb+TVuRVjZ51hfAhgvAQ88JfBsGWwbfzEvQx23cI0/ICHEVsdSg9uHC7PxcnbVo5n7DDQshc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560776235822996.5780287694623; Mon, 17 Jun 2019 05:57:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3302307D96F; Mon, 17 Jun 2019 12:56:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B2E97DF50; Mon, 17 Jun 2019 12:56:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 244E31806B18; Mon, 17 Jun 2019 12:56:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCtiWM024605 for ; Mon, 17 Jun 2019 08:55:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 45D1F3781; Mon, 17 Jun 2019 12:55:44 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F1B017C67 for ; Mon, 17 Jun 2019 12:55:43 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:31 +0200 Message-Id: <0487e47c2bb6e9197b58338ea834dd4dd5945230.1560775960.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 6/9] tests: Drop qemuargv2xmltest X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 17 Jun 2019 12:57:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that we no longer use that functionality we can also drop the tests. Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- tests/Makefile.am | 11 +- tests/qemuargv2xmldata/boot-cdrom.args | 22 -- tests/qemuargv2xmldata/boot-cdrom.xml | 35 -- tests/qemuargv2xmldata/boot-floppy.args | 23 -- tests/qemuargv2xmldata/boot-floppy.xml | 41 --- tests/qemuargv2xmldata/boot-network.args | 22 -- tests/qemuargv2xmldata/boot-network.xml | 34 -- tests/qemuargv2xmldata/clock-localtime.args | 23 -- tests/qemuargv2xmldata/clock-localtime.xml | 34 -- tests/qemuargv2xmldata/clock-utc.args | 22 -- tests/qemuargv2xmldata/clock-utc.xml | 34 -- tests/qemuargv2xmldata/console-compat.args | 22 -- tests/qemuargv2xmldata/console-compat.xml | 42 --- tests/qemuargv2xmldata/disk-cdrom-empty.args | 23 -- tests/qemuargv2xmldata/disk-cdrom-empty.xml | 40 --- tests/qemuargv2xmldata/disk-cdrom.args | 23 -- tests/qemuargv2xmldata/disk-cdrom.xml | 41 --- .../disk-drive-boot-cdrom.args | 23 -- .../disk-drive-boot-cdrom.xml | 41 --- .../disk-drive-boot-disk.args | 23 -- .../qemuargv2xmldata/disk-drive-boot-disk.xml | 41 --- .../disk-drive-cache-directsync.args | 24 -- .../disk-drive-cache-directsync.xml | 41 --- .../disk-drive-cache-unsafe.args | 24 -- .../disk-drive-cache-unsafe.xml | 41 --- .../disk-drive-cache-v2-none.args | 23 -- .../disk-drive-cache-v2-none.xml | 41 --- .../disk-drive-cache-v2-wb.args | 24 -- .../disk-drive-cache-v2-wb.xml | 41 --- .../disk-drive-cache-v2-wt.args | 24 -- .../disk-drive-cache-v2-wt.xml | 41 --- .../disk-drive-error-policy-enospace.args | 24 -- .../disk-drive-error-policy-enospace.xml | 41 --- .../disk-drive-error-policy-stop.args | 24 -- .../disk-drive-error-policy-stop.xml | 41 --- ...sk-drive-error-policy-wreport-rignore.args | 24 -- ...isk-drive-error-policy-wreport-rignore.xml | 41 --- .../qemuargv2xmldata/disk-drive-fmt-qcow.args | 23 -- .../qemuargv2xmldata/disk-drive-fmt-qcow.xml | 41 --- .../disk-drive-network-gluster.args | 25 -- .../disk-drive-network-gluster.xml | 41 --- .../disk-drive-network-iscsi-auth.args | 25 -- .../disk-drive-network-iscsi-auth.xml | 44 --- .../disk-drive-network-iscsi.args | 25 -- .../disk-drive-network-iscsi.xml | 41 --- .../disk-drive-network-nbd-export.args | 23 -- .../disk-drive-network-nbd-export.xml | 42 --- .../disk-drive-network-nbd-ipv6-export.args | 23 -- .../disk-drive-network-nbd-ipv6-export.xml | 42 --- .../disk-drive-network-nbd-ipv6.args | 23 -- .../disk-drive-network-nbd-ipv6.xml | 42 --- .../disk-drive-network-nbd-unix.args | 23 -- .../disk-drive-network-nbd-unix.xml | 42 --- .../disk-drive-network-nbd.args | 23 -- .../disk-drive-network-nbd.xml | 42 --- .../disk-drive-network-rbd-auth.args | 26 -- .../disk-drive-network-rbd-auth.xml | 47 --- .../disk-drive-network-rbd-ceph-env.args | 25 -- .../disk-drive-network-rbd-ceph-env.xml | 44 --- .../disk-drive-network-rbd-ipv6.args | 25 -- .../disk-drive-network-rbd-ipv6.xml | 45 --- .../disk-drive-network-rbd.args | 29 -- .../disk-drive-network-rbd.xml | 72 ---- .../disk-drive-network-sheepdog.args | 23 -- .../disk-drive-network-sheepdog.xml | 42 --- tests/qemuargv2xmldata/disk-floppy.args | 24 -- tests/qemuargv2xmldata/disk-floppy.xml | 47 --- tests/qemuargv2xmldata/disk-many.args | 25 -- tests/qemuargv2xmldata/disk-many.xml | 52 --- tests/qemuargv2xmldata/disk-usb.args | 23 -- tests/qemuargv2xmldata/disk-usb.xml | 39 --- tests/qemuargv2xmldata/disk-virtio.args | 25 -- tests/qemuargv2xmldata/disk-virtio.xml | 53 --- .../graphics-sdl-fullscreen.args | 25 -- .../graphics-sdl-fullscreen.xml | 39 --- tests/qemuargv2xmldata/graphics-sdl.args | 24 -- tests/qemuargv2xmldata/graphics-sdl.xml | 39 --- .../qemuargv2xmldata/graphics-vnc-policy.args | 23 -- .../qemuargv2xmldata/graphics-vnc-policy.xml | 41 --- tests/qemuargv2xmldata/graphics-vnc-sasl.args | 24 -- tests/qemuargv2xmldata/graphics-vnc-sasl.xml | 41 --- .../qemuargv2xmldata/graphics-vnc-socket.args | 23 -- .../qemuargv2xmldata/graphics-vnc-socket.xml | 41 --- tests/qemuargv2xmldata/graphics-vnc-tls.args | 24 -- tests/qemuargv2xmldata/graphics-vnc-tls.xml | 41 --- .../graphics-vnc-websocket.args | 22 -- .../graphics-vnc-websocket.xml | 32 -- tests/qemuargv2xmldata/graphics-vnc.args | 23 -- tests/qemuargv2xmldata/graphics-vnc.xml | 41 --- .../qemuargv2xmldata/hostdev-pci-address.args | 23 -- .../qemuargv2xmldata/hostdev-pci-address.xml | 40 --- .../qemuargv2xmldata/hostdev-usb-address.args | 23 -- .../qemuargv2xmldata/hostdev-usb-address.xml | 39 --- tests/qemuargv2xmldata/hyperv-panic.args | 21 -- tests/qemuargv2xmldata/hyperv-panic.xml | 29 -- tests/qemuargv2xmldata/hyperv.args | 21 -- tests/qemuargv2xmldata/hyperv.xml | 33 -- tests/qemuargv2xmldata/input-usbmouse.args | 23 -- tests/qemuargv2xmldata/input-usbmouse.xml | 35 -- tests/qemuargv2xmldata/input-usbtablet.args | 23 -- tests/qemuargv2xmldata/input-usbtablet.xml | 35 -- tests/qemuargv2xmldata/kvm-features.args | 21 -- tests/qemuargv2xmldata/kvm-features.xml | 31 -- tests/qemuargv2xmldata/kvmclock.args | 22 -- tests/qemuargv2xmldata/kvmclock.xml | 30 -- .../machine-aeskeywrap-off-argv.args | 18 - .../machine-aeskeywrap-off-argv.xml | 23 -- .../machine-aeskeywrap-on-argv.args | 18 - .../machine-aeskeywrap-on-argv.xml | 23 -- tests/qemuargv2xmldata/machine-core-off.args | 22 -- tests/qemuargv2xmldata/machine-core-off.xml | 34 -- tests/qemuargv2xmldata/machine-core-on.args | 22 -- tests/qemuargv2xmldata/machine-core-on.xml | 34 -- .../machine-deakeywrap-off-argv.args | 18 - .../machine-deakeywrap-off-argv.xml | 23 -- .../machine-deakeywrap-on-argv.args | 18 - .../machine-deakeywrap-on-argv.xml | 23 -- .../machine-keywrap-none-argv.args | 18 - .../machine-keywrap-none-argv.xml | 20 -- .../qemuargv2xmldata/mem-scale-maxmemory.args | 22 -- .../qemuargv2xmldata/mem-scale-maxmemory.xml | 38 --- tests/qemuargv2xmldata/mem-scale.args | 22 -- tests/qemuargv2xmldata/mem-scale.xml | 37 -- tests/qemuargv2xmldata/migrate.args | 23 -- tests/qemuargv2xmldata/migrate.xml | 34 -- tests/qemuargv2xmldata/misc-acpi.args | 21 -- tests/qemuargv2xmldata/misc-acpi.xml | 37 -- tests/qemuargv2xmldata/misc-disable-s3.args | 23 -- tests/qemuargv2xmldata/misc-disable-s3.xml | 37 -- .../misc-disable-suspends.args | 24 -- .../misc-disable-suspends.xml | 38 --- tests/qemuargv2xmldata/misc-enable-s4.args | 23 -- tests/qemuargv2xmldata/misc-enable-s4.xml | 37 -- tests/qemuargv2xmldata/misc-no-reboot.args | 23 -- tests/qemuargv2xmldata/misc-no-reboot.xml | 34 -- tests/qemuargv2xmldata/misc-uuid.args | 21 -- tests/qemuargv2xmldata/misc-uuid.xml | 37 -- tests/qemuargv2xmldata/net-eth-ifname.args | 23 -- tests/qemuargv2xmldata/net-eth-ifname.xml | 41 --- tests/qemuargv2xmldata/net-eth.args | 23 -- tests/qemuargv2xmldata/net-eth.xml | 40 --- tests/qemuargv2xmldata/net-user.args | 23 -- tests/qemuargv2xmldata/net-user.xml | 39 --- tests/qemuargv2xmldata/net-virtio.args | 23 -- tests/qemuargv2xmldata/net-virtio.xml | 39 --- .../nographics-vga-display.args | 23 -- .../nographics-vga-display.xml | 34 -- tests/qemuargv2xmldata/nographics-vga.args | 23 -- tests/qemuargv2xmldata/nographics-vga.xml | 34 -- tests/qemuargv2xmldata/nomachine-ppc64.args | 11 - tests/qemuargv2xmldata/nomachine-ppc64.xml | 50 --- tests/qemuargv2xmldata/nomachine-x86_64.args | 11 - tests/qemuargv2xmldata/nomachine-x86_64.xml | 49 --- tests/qemuargv2xmldata/nosharepages.args | 22 -- tests/qemuargv2xmldata/nosharepages.xml | 37 -- tests/qemuargv2xmldata/parallel-tcp.args | 22 -- tests/qemuargv2xmldata/parallel-tcp.xml | 39 --- tests/qemuargv2xmldata/pseries-disk.args | 18 - tests/qemuargv2xmldata/pseries-disk.xml | 50 --- tests/qemuargv2xmldata/pseries-nvram.args | 22 -- tests/qemuargv2xmldata/pseries-nvram.xml | 30 -- tests/qemuargv2xmldata/qemu-ns-no-env.args | 23 -- tests/qemuargv2xmldata/qemu-ns-no-env.xml | 38 --- .../reboot-timeout-disabled.args | 21 -- .../reboot-timeout-disabled.xml | 26 -- .../reboot-timeout-enabled.args | 21 -- .../reboot-timeout-enabled.xml | 26 -- tests/qemuargv2xmldata/restore-v2.args | 23 -- tests/qemuargv2xmldata/restore-v2.xml | 34 -- tests/qemuargv2xmldata/serial-dev.args | 22 -- tests/qemuargv2xmldata/serial-dev.xml | 44 --- tests/qemuargv2xmldata/serial-file.args | 22 -- tests/qemuargv2xmldata/serial-file.xml | 44 --- tests/qemuargv2xmldata/serial-many.args | 23 -- tests/qemuargv2xmldata/serial-many.xml | 48 --- tests/qemuargv2xmldata/serial-pty.args | 22 -- tests/qemuargv2xmldata/serial-pty.xml | 42 --- tests/qemuargv2xmldata/serial-tcp-telnet.args | 22 -- tests/qemuargv2xmldata/serial-tcp-telnet.xml | 46 --- tests/qemuargv2xmldata/serial-tcp.args | 22 -- tests/qemuargv2xmldata/serial-tcp.xml | 46 --- tests/qemuargv2xmldata/serial-udp.args | 23 -- tests/qemuargv2xmldata/serial-udp.xml | 52 --- tests/qemuargv2xmldata/serial-unix.args | 22 -- tests/qemuargv2xmldata/serial-unix.xml | 44 --- tests/qemuargv2xmldata/serial-vc.args | 22 -- tests/qemuargv2xmldata/serial-vc.xml | 42 --- tests/qemuargv2xmldata/smp.args | 22 -- tests/qemuargv2xmldata/smp.xml | 37 -- tests/qemuargv2xmldata/sound.args | 23 -- tests/qemuargv2xmldata/sound.xml | 42 --- tests/qemuargv2xmldata/watchdog.args | 24 -- tests/qemuargv2xmldata/watchdog.xml | 35 -- tests/qemuargv2xmltest.c | 323 ------------------ tests/virschematest.c | 2 +- 195 files changed, 3 insertions(+), 6243 deletions(-) delete mode 100644 tests/qemuargv2xmldata/boot-cdrom.args delete mode 100644 tests/qemuargv2xmldata/boot-cdrom.xml delete mode 100644 tests/qemuargv2xmldata/boot-floppy.args delete mode 100644 tests/qemuargv2xmldata/boot-floppy.xml delete mode 100644 tests/qemuargv2xmldata/boot-network.args delete mode 100644 tests/qemuargv2xmldata/boot-network.xml delete mode 100644 tests/qemuargv2xmldata/clock-localtime.args delete mode 100644 tests/qemuargv2xmldata/clock-localtime.xml delete mode 100644 tests/qemuargv2xmldata/clock-utc.args delete mode 100644 tests/qemuargv2xmldata/clock-utc.xml delete mode 100644 tests/qemuargv2xmldata/console-compat.args delete mode 100644 tests/qemuargv2xmldata/console-compat.xml delete mode 100644 tests/qemuargv2xmldata/disk-cdrom-empty.args delete mode 100644 tests/qemuargv2xmldata/disk-cdrom-empty.xml delete mode 100644 tests/qemuargv2xmldata/disk-cdrom.args delete mode 100644 tests/qemuargv2xmldata/disk-cdrom.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-boot-cdrom.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-boot-cdrom.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-boot-disk.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-boot-disk.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-directsync.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-directsync.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-unsafe.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-unsafe.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-v2-none.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-v2-none.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-v2-wb.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-v2-wb.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-v2-wt.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-cache-v2-wt.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-error-policy-enospace= .args delete mode 100644 tests/qemuargv2xmldata/disk-drive-error-policy-enospace= .xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-error-policy-stop.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-error-policy-stop.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-error-policy-wreport-= rignore.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-error-policy-wreport-= rignore.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-fmt-qcow.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-fmt-qcow.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-gluster.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-gluster.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-iscsi-auth.ar= gs delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-iscsi-auth.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-iscsi.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-iscsi.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-export.ar= gs delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-export.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-ipv6-expo= rt.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-ipv6-expo= rt.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-ipv6.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-ipv6.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-unix.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd-unix.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-nbd.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd-auth.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd-auth.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd-ceph-env.= args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd-ceph-env.= xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd-ipv6.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd-ipv6.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-rbd.xml delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-sheepdog.args delete mode 100644 tests/qemuargv2xmldata/disk-drive-network-sheepdog.xml delete mode 100644 tests/qemuargv2xmldata/disk-floppy.args delete mode 100644 tests/qemuargv2xmldata/disk-floppy.xml delete mode 100644 tests/qemuargv2xmldata/disk-many.args delete mode 100644 tests/qemuargv2xmldata/disk-many.xml delete mode 100644 tests/qemuargv2xmldata/disk-usb.args delete mode 100644 tests/qemuargv2xmldata/disk-usb.xml delete mode 100644 tests/qemuargv2xmldata/disk-virtio.args delete mode 100644 tests/qemuargv2xmldata/disk-virtio.xml delete mode 100644 tests/qemuargv2xmldata/graphics-sdl-fullscreen.args delete mode 100644 tests/qemuargv2xmldata/graphics-sdl-fullscreen.xml delete mode 100644 tests/qemuargv2xmldata/graphics-sdl.args delete mode 100644 tests/qemuargv2xmldata/graphics-sdl.xml delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-policy.args delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-policy.xml delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-sasl.args delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-sasl.xml delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-socket.args delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-socket.xml delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-tls.args delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-tls.xml delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-websocket.args delete mode 100644 tests/qemuargv2xmldata/graphics-vnc-websocket.xml delete mode 100644 tests/qemuargv2xmldata/graphics-vnc.args delete mode 100644 tests/qemuargv2xmldata/graphics-vnc.xml delete mode 100644 tests/qemuargv2xmldata/hostdev-pci-address.args delete mode 100644 tests/qemuargv2xmldata/hostdev-pci-address.xml delete mode 100644 tests/qemuargv2xmldata/hostdev-usb-address.args delete mode 100644 tests/qemuargv2xmldata/hostdev-usb-address.xml delete mode 100644 tests/qemuargv2xmldata/hyperv-panic.args delete mode 100644 tests/qemuargv2xmldata/hyperv-panic.xml delete mode 100644 tests/qemuargv2xmldata/hyperv.args delete mode 100644 tests/qemuargv2xmldata/hyperv.xml delete mode 100644 tests/qemuargv2xmldata/input-usbmouse.args delete mode 100644 tests/qemuargv2xmldata/input-usbmouse.xml delete mode 100644 tests/qemuargv2xmldata/input-usbtablet.args delete mode 100644 tests/qemuargv2xmldata/input-usbtablet.xml delete mode 100644 tests/qemuargv2xmldata/kvm-features.args delete mode 100644 tests/qemuargv2xmldata/kvm-features.xml delete mode 100644 tests/qemuargv2xmldata/kvmclock.args delete mode 100644 tests/qemuargv2xmldata/kvmclock.xml delete mode 100644 tests/qemuargv2xmldata/machine-aeskeywrap-off-argv.args delete mode 100644 tests/qemuargv2xmldata/machine-aeskeywrap-off-argv.xml delete mode 100644 tests/qemuargv2xmldata/machine-aeskeywrap-on-argv.args delete mode 100644 tests/qemuargv2xmldata/machine-aeskeywrap-on-argv.xml delete mode 100644 tests/qemuargv2xmldata/machine-core-off.args delete mode 100644 tests/qemuargv2xmldata/machine-core-off.xml delete mode 100644 tests/qemuargv2xmldata/machine-core-on.args delete mode 100644 tests/qemuargv2xmldata/machine-core-on.xml delete mode 100644 tests/qemuargv2xmldata/machine-deakeywrap-off-argv.args delete mode 100644 tests/qemuargv2xmldata/machine-deakeywrap-off-argv.xml delete mode 100644 tests/qemuargv2xmldata/machine-deakeywrap-on-argv.args delete mode 100644 tests/qemuargv2xmldata/machine-deakeywrap-on-argv.xml delete mode 100644 tests/qemuargv2xmldata/machine-keywrap-none-argv.args delete mode 100644 tests/qemuargv2xmldata/machine-keywrap-none-argv.xml delete mode 100644 tests/qemuargv2xmldata/mem-scale-maxmemory.args delete mode 100644 tests/qemuargv2xmldata/mem-scale-maxmemory.xml delete mode 100644 tests/qemuargv2xmldata/mem-scale.args delete mode 100644 tests/qemuargv2xmldata/mem-scale.xml delete mode 100644 tests/qemuargv2xmldata/migrate.args delete mode 100644 tests/qemuargv2xmldata/migrate.xml delete mode 100644 tests/qemuargv2xmldata/misc-acpi.args delete mode 100644 tests/qemuargv2xmldata/misc-acpi.xml delete mode 100644 tests/qemuargv2xmldata/misc-disable-s3.args delete mode 100644 tests/qemuargv2xmldata/misc-disable-s3.xml delete mode 100644 tests/qemuargv2xmldata/misc-disable-suspends.args delete mode 100644 tests/qemuargv2xmldata/misc-disable-suspends.xml delete mode 100644 tests/qemuargv2xmldata/misc-enable-s4.args delete mode 100644 tests/qemuargv2xmldata/misc-enable-s4.xml delete mode 100644 tests/qemuargv2xmldata/misc-no-reboot.args delete mode 100644 tests/qemuargv2xmldata/misc-no-reboot.xml delete mode 100644 tests/qemuargv2xmldata/misc-uuid.args delete mode 100644 tests/qemuargv2xmldata/misc-uuid.xml delete mode 100644 tests/qemuargv2xmldata/net-eth-ifname.args delete mode 100644 tests/qemuargv2xmldata/net-eth-ifname.xml delete mode 100644 tests/qemuargv2xmldata/net-eth.args delete mode 100644 tests/qemuargv2xmldata/net-eth.xml delete mode 100644 tests/qemuargv2xmldata/net-user.args delete mode 100644 tests/qemuargv2xmldata/net-user.xml delete mode 100644 tests/qemuargv2xmldata/net-virtio.args delete mode 100644 tests/qemuargv2xmldata/net-virtio.xml delete mode 100644 tests/qemuargv2xmldata/nographics-vga-display.args delete mode 100644 tests/qemuargv2xmldata/nographics-vga-display.xml delete mode 100644 tests/qemuargv2xmldata/nographics-vga.args delete mode 100644 tests/qemuargv2xmldata/nographics-vga.xml delete mode 100644 tests/qemuargv2xmldata/nomachine-ppc64.args delete mode 100644 tests/qemuargv2xmldata/nomachine-ppc64.xml delete mode 100644 tests/qemuargv2xmldata/nomachine-x86_64.args delete mode 100644 tests/qemuargv2xmldata/nomachine-x86_64.xml delete mode 100644 tests/qemuargv2xmldata/nosharepages.args delete mode 100644 tests/qemuargv2xmldata/nosharepages.xml delete mode 100644 tests/qemuargv2xmldata/parallel-tcp.args delete mode 100644 tests/qemuargv2xmldata/parallel-tcp.xml delete mode 100644 tests/qemuargv2xmldata/pseries-disk.args delete mode 100644 tests/qemuargv2xmldata/pseries-disk.xml delete mode 100644 tests/qemuargv2xmldata/pseries-nvram.args delete mode 100644 tests/qemuargv2xmldata/pseries-nvram.xml delete mode 100644 tests/qemuargv2xmldata/qemu-ns-no-env.args delete mode 100644 tests/qemuargv2xmldata/qemu-ns-no-env.xml delete mode 100644 tests/qemuargv2xmldata/reboot-timeout-disabled.args delete mode 100644 tests/qemuargv2xmldata/reboot-timeout-disabled.xml delete mode 100644 tests/qemuargv2xmldata/reboot-timeout-enabled.args delete mode 100644 tests/qemuargv2xmldata/reboot-timeout-enabled.xml delete mode 100644 tests/qemuargv2xmldata/restore-v2.args delete mode 100644 tests/qemuargv2xmldata/restore-v2.xml delete mode 100644 tests/qemuargv2xmldata/serial-dev.args delete mode 100644 tests/qemuargv2xmldata/serial-dev.xml delete mode 100644 tests/qemuargv2xmldata/serial-file.args delete mode 100644 tests/qemuargv2xmldata/serial-file.xml delete mode 100644 tests/qemuargv2xmldata/serial-many.args delete mode 100644 tests/qemuargv2xmldata/serial-many.xml delete mode 100644 tests/qemuargv2xmldata/serial-pty.args delete mode 100644 tests/qemuargv2xmldata/serial-pty.xml delete mode 100644 tests/qemuargv2xmldata/serial-tcp-telnet.args delete mode 100644 tests/qemuargv2xmldata/serial-tcp-telnet.xml delete mode 100644 tests/qemuargv2xmldata/serial-tcp.args delete mode 100644 tests/qemuargv2xmldata/serial-tcp.xml delete mode 100644 tests/qemuargv2xmldata/serial-udp.args delete mode 100644 tests/qemuargv2xmldata/serial-udp.xml delete mode 100644 tests/qemuargv2xmldata/serial-unix.args delete mode 100644 tests/qemuargv2xmldata/serial-unix.xml delete mode 100644 tests/qemuargv2xmldata/serial-vc.args delete mode 100644 tests/qemuargv2xmldata/serial-vc.xml delete mode 100644 tests/qemuargv2xmldata/smp.args delete mode 100644 tests/qemuargv2xmldata/smp.xml delete mode 100644 tests/qemuargv2xmldata/sound.args delete mode 100644 tests/qemuargv2xmldata/sound.xml delete mode 100644 tests/qemuargv2xmldata/watchdog.args delete mode 100644 tests/qemuargv2xmldata/watchdog.xml delete mode 100644 tests/qemuargv2xmltest.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 5ba529124a..0f51a8944f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -109,7 +109,6 @@ EXTRA_DIST =3D \ nwfilterxml2xmlout \ oomtrace.pl \ qemuagentdata \ - qemuargv2xmldata \ qemublocktestdata \ qemucapabilitiesdata \ qemucaps2xmloutdata \ @@ -275,7 +274,7 @@ endif WITH_LIBXL if WITH_QEMU test_programs +=3D qemuxml2argvtest qemuxml2xmltest \ - qemuargv2xmltest domainsnapshotxml2xmltest \ + domainsnapshotxml2xmltest \ qemumonitorjsontest qemuhotplugtest \ qemuagenttest qemucapabilitiestest qemucaps2xmltest \ qemumemlocktest \ @@ -583,12 +582,6 @@ qemuxml2xmltest_SOURCES =3D \ testutils.c testutils.h qemuxml2xmltest_LDADD =3D $(qemu_LDADDS) -qemuargv2xmltest_SOURCES =3D \ - qemuargv2xmltest.c testutilsqemu.c testutilsqemu.h \ - testutils.c testutils.h -qemuargv2xmltest_LDADD =3D libqemutestdriver.la \ - $(LDADDS) - qemumonitorjsontest_SOURCES =3D \ qemumonitorjsontest.c \ testutils.c testutils.h \ @@ -695,7 +688,7 @@ qemufirmwaretest_SOURCES =3D \ qemufirmwaretest_LDADD =3D $(qemu_LDADDS) else ! WITH_QEMU -EXTRA_DIST +=3D qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \ +EXTRA_DIST +=3D qemuxml2argvtest.c qemuxml2xmltest.c \ domainsnapshotxml2xmltest.c \ testutilsqemu.c testutilsqemu.h \ testutilsqemuschema.c testutilsqemuschema.h \ diff --git a/tests/qemuargv2xmldata/boot-cdrom.args b/tests/qemuargv2xmldat= a/boot-cdrom.args deleted file mode 100644 index 6a7e0e2867..0000000000 --- a/tests/qemuargv2xmldata/boot-cdrom.args +++ /dev/null @@ -1,22 +0,0 @@ -LC_ALL=3DC \ -PATH=3D/bin \ -HOME=3D/home/test \ -USER=3Dtest \ -LOGNAME=3Dtest \ -QEMU_AUDIO_DRV=3Dnone \ -/usr/bin/qemu-system-i686 \ --name QEMUGuest1 \ --S \ --M pc \ --m 214 \ --smp 1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --nographic \ --monitor unix:/tmp/test-monitor,server,nowait \ --no-acpi \ --boot d \ --usb \ --drive file=3D/dev/cdrom,format=3Draw,if=3Dide,media=3Dcdrom,bus=3D1,unit= =3D0 \ --net none \ --serial none \ --parallel none [...] Patch truncated. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560776215; cv=none; d=zoho.com; s=zohoarc; b=YvfuahHh9gEXik33s7Dv9LIDAgp/mkQ3SeQvOoT0CXTVKLyU9ZDpoxkPZVFhORRhxOA/P7UjI6R+rdXbcudebJxDWF2Bv6jKT5frK94IXSnf1x58MKFbsQuJWE3xZYZbNI1jA5SQQ086pevEJjnpgxBGYmMyB8J6w7EvbZYeh7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560776215; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=evI4nJwG6ugrMzefGgatbZG8UEWkoOeItaulz5gqGQI=; b=gBqyXwQ2fhxW+uavmUlMZ2qsKOmXC5YJdACOcwyBWWo34k5wkr1TJ3ZpVluyIPbyK2+K8cItwUi52uAC98DT1tPFv+LTyItwOU7SVuAA5ni01SQlkDPLoEw3M28cqD+p5W124K2X6+vXhSQ6QQkGIUAqvU7T/hlentpJCkHbCqI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156077621512151.24899786712945; Mon, 17 Jun 2019 05:56:55 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B36526EB8E; Mon, 17 Jun 2019 12:56:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0601E100996F; Mon, 17 Jun 2019 12:56:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E7567206D4; Mon, 17 Jun 2019 12:56:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCtjIr024620 for ; Mon, 17 Jun 2019 08:55:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 62BFF3781; Mon, 17 Jun 2019 12:55:45 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95F5317C67 for ; Mon, 17 Jun 2019 12:55:44 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:32 +0200 Message-Id: <5d9e473fcbd86edd4f4782de268352ff853bd8ee.1560775960.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 7/9] qemu: parse: Drop unused qemu command line parsing infrastructure X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Jun 2019 12:56:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" It's now unused and utterly obsolete. Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_parse_command.c | 2622 +-------------------------------- src/qemu/qemu_parse_command.h | 14 - 2 files changed, 1 insertion(+), 2635 deletions(-) diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index b522882c78..b49aa92fb3 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -21,363 +21,17 @@ #include -#include "qemu_command.h" #include "qemu_parse_command.h" -#include "dirname.h" #include "viralloc.h" #include "virlog.h" -#include "virsecret.h" #include "virstring.h" -#include "c-ctype.h" +#include "virerror.h" #define VIR_FROM_THIS VIR_FROM_QEMU VIR_LOG_INIT("qemu.qemu_parse_command"); -static int -qemuParseRBDString(virDomainDiskDefPtr disk) -{ - char *source =3D disk->src->path; - int ret; - - disk->src->path =3D NULL; - - ret =3D virStorageSourceParseRBDColonString(source, disk->src); - - VIR_FREE(source); - return ret; -} - - -static int -qemuParseDriveURIString(virDomainDiskDefPtr def, virURIPtr uri, - const char *scheme) -{ - int ret =3D -1; - char *transp =3D NULL; - char *sock =3D NULL; - char *volimg =3D NULL; - char *secret =3D NULL; - VIR_AUTOPTR(virStorageAuthDef) authdef =3D NULL; - - if (VIR_ALLOC(def->src->hosts) < 0) - goto error; - - transp =3D strchr(uri->scheme, '+'); - if (transp) - *transp++ =3D 0; - - if (STRNEQ(uri->scheme, scheme)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid transport/scheme '%s'"), uri->scheme); - goto error; - } - - if (!transp) { - def->src->hosts->transport =3D VIR_STORAGE_NET_HOST_TRANS_TCP; - } else { - def->src->hosts->transport =3D virStorageNetHostTransportTypeFromS= tring(transp); - if (def->src->hosts->transport < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid %s transport type '%s'"), scheme, tr= ansp); - goto error; - } - } - def->src->nhosts =3D 0; /* set to 1 once everything succeeds */ - - if (def->src->hosts->transport !=3D VIR_STORAGE_NET_HOST_TRANS_UNIX) { - if (VIR_STRDUP(def->src->hosts->name, uri->server) < 0) - goto error; - - def->src->hosts->port =3D uri->port; - } else { - def->src->hosts->name =3D NULL; - def->src->hosts->port =3D 0; - if (uri->query) { - if (STRPREFIX(uri->query, "socket=3D")) { - sock =3D strchr(uri->query, '=3D') + 1; - if (VIR_STRDUP(def->src->hosts->socket, sock) < 0) - goto error; - } else { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid query parameter '%s'"), uri->que= ry); - goto error; - } - } - } - if (uri->path) { - volimg =3D uri->path + 1; /* skip the prefix slash */ - VIR_FREE(def->src->path); - if (VIR_STRDUP(def->src->path, volimg) < 0) - goto error; - } else { - VIR_FREE(def->src->path); - } - - if (uri->user) { - const char *secrettype; - /* formulate authdef for disk->src->auth */ - if (VIR_ALLOC(authdef) < 0) - goto error; - - secret =3D strchr(uri->user, ':'); - if (secret) - *secret =3D '\0'; - - if (VIR_STRDUP(authdef->username, uri->user) < 0) - goto error; - if (STREQ(scheme, "iscsi")) { - secrettype =3D - virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI); - if (VIR_STRDUP(authdef->secrettype, secrettype) < 0) - goto error; - } - VIR_STEAL_PTR(def->src->auth, authdef); - - /* Cannot formulate a secretType (eg, usage or uuid) given - * what is provided. - */ - } - - def->src->nhosts =3D 1; - ret =3D 0; - - cleanup: - virURIFree(uri); - - return ret; - - error: - virStorageNetHostDefClear(def->src->hosts); - VIR_FREE(def->src->hosts); - goto cleanup; -} - -static int -qemuParseGlusterString(virDomainDiskDefPtr def) -{ - virURIPtr uri =3D NULL; - - if (!(uri =3D virURIParse(def->src->path))) - return -1; - - return qemuParseDriveURIString(def, uri, "gluster"); -} - -static int -qemuParseISCSIString(virDomainDiskDefPtr def) -{ - virURIPtr uri =3D NULL; - char *slash; - unsigned lun; - - if (!(uri =3D virURIParse(def->src->path))) - return -1; - - if (uri->path && - (slash =3D strchr(uri->path + 1, '/')) !=3D NULL) { - - if (slash[1] =3D=3D '\0') { - *slash =3D '\0'; - } else if (virStrToLong_ui(slash + 1, NULL, 10, &lun) =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid name '%s' for iSCSI disk"), - def->src->path); - virURIFree(uri); - return -1; - } - } - - return qemuParseDriveURIString(def, uri, "iscsi"); -} - -static int -qemuParseNBDString(virDomainDiskDefPtr disk) -{ - virStorageNetHostDefPtr h =3D NULL; - char *host, *port; - char *src; - - virURIPtr uri =3D NULL; - - if (strstr(disk->src->path, "://")) { - if (!(uri =3D virURIParse(disk->src->path))) - return -1; - return qemuParseDriveURIString(disk, uri, "nbd"); - } - - if (VIR_ALLOC(h) < 0) - goto error; - - host =3D disk->src->path + strlen("nbd:"); - if (STRPREFIX(host, "unix:/")) { - src =3D strchr(host + strlen("unix:"), ':'); - if (src) - *src++ =3D '\0'; - - h->transport =3D VIR_STORAGE_NET_HOST_TRANS_UNIX; - if (VIR_STRDUP(h->socket, host + strlen("unix:")) < 0) - goto error; - } else { - port =3D strchr(host, ':'); - if (!port) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse nbd filename '%s'"), disk->src-= >path); - goto error; - } - - *port++ =3D '\0'; - if (VIR_STRDUP(h->name, host) < 0) - goto error; - - src =3D strchr(port, ':'); - if (src) - *src++ =3D '\0'; - - if (virStringParsePort(port, &h->port) < 0) - goto error; - } - - if (src && STRPREFIX(src, "exportname=3D")) { - if (VIR_STRDUP(src, strchr(src, '=3D') + 1) < 0) - goto error; - } else { - src =3D NULL; - } - - VIR_FREE(disk->src->path); - disk->src->path =3D src; - disk->src->nhosts =3D 1; - disk->src->hosts =3D h; - return 0; - - error: - virStorageNetHostDefClear(h); - VIR_FREE(h); - return -1; -} - - -/* - * This method takes a string representing a QEMU command line ARGV set - * optionally prefixed by a list of environment variables. It then tries - * to split it up into a NULL terminated list of env & argv, splitting - * on space - */ -static int qemuStringToArgvEnv(const char *args, - char ***retenv, - char ***retargv) -{ - char **arglist =3D NULL; - size_t argcount =3D 0; - size_t argalloc =3D 0; - size_t envend; - size_t i; - const char *curr =3D args; - const char *start; - char **progenv =3D NULL; - char **progargv =3D NULL; - - /* Iterate over string, splitting on sequences of ' ' */ - while (curr && *curr !=3D '\0') { - char *arg; - const char *next; - - start =3D curr; - /* accept a space in CEPH_ARGS */ - if (STRPREFIX(curr, "CEPH_ARGS=3D-m ")) - start +=3D strlen("CEPH_ARGS=3D-m "); - if (*start =3D=3D '\'') { - if (start =3D=3D curr) - curr++; - next =3D strchr(start + 1, '\''); - } else if (*start =3D=3D '"') { - if (start =3D=3D curr) - curr++; - next =3D strchr(start + 1, '"'); - } else { - next =3D strchr(start, ' '); - } - if (!next) - next =3D strchr(curr, '\n'); - - if (VIR_STRNDUP(arg, curr, next ? next - curr : -1) < 0) - goto error; - - if (next && (*next =3D=3D '\'' || *next =3D=3D '"')) - next++; - - if (VIR_RESIZE_N(arglist, argalloc, argcount, 2) < 0) { - VIR_FREE(arg); - goto error; - } - - arglist[argcount++] =3D arg; - arglist[argcount] =3D NULL; - - while (next && c_isspace(*next)) - next++; - - curr =3D next; - } - - /* Iterate over list of args, finding first arg not containing - * the '=3D' character (eg, skip over env vars FOO=3Dbar) */ - for (envend =3D 0; ((envend < argcount) && - (strchr(arglist[envend], '=3D') !=3D NULL)); - envend++) - ; /* nada */ - - /* Copy the list of env vars */ - if (envend > 0) { - if (VIR_REALLOC_N(progenv, envend+1) < 0) - goto error; - for (i =3D 0; i < envend; i++) - progenv[i] =3D arglist[i]; - progenv[i] =3D NULL; - } - - /* Copy the list of argv */ - if (VIR_REALLOC_N(progargv, argcount-envend + 1) < 0) - goto error; - for (i =3D envend; i < argcount; i++) - progargv[i-envend] =3D arglist[i]; - progargv[i-envend] =3D NULL; - - VIR_FREE(arglist); - - *retenv =3D progenv; - *retargv =3D progargv; - - return 0; - - error: - VIR_FREE(progenv); - VIR_FREE(progargv); - virStringListFree(arglist); - return -1; -} - - -/* - * Search for a named env variable, and return the value part - */ -static const char *qemuFindEnv(char **progenv, - const char *name) -{ - size_t i; - int len =3D strlen(name); - - for (i =3D 0; progenv && progenv[i]; i++) { - if (STREQLEN(progenv[i], name, len) && - progenv[i][len] =3D=3D '=3D') - return progenv[i] + len + 1; - } - return NULL; -} - - void qemuParseKeywordsFree(int nkeywords, char **keywords, @@ -493,2277 +147,3 @@ qemuParseKeywords(const char *str, qemuParseKeywordsFree(keywordCount, keywords, values); return -1; } - - -/* qemuParseCommandLineVnc - * - * Tries to parse the various "-vnc ..." argument formats. - */ -static int -qemuParseCommandLineVnc(virDomainDefPtr def, - const char *val) -{ - int ret =3D -1; - virDomainGraphicsDefPtr vnc =3D NULL; - char *listenAddr =3D NULL; - char *tmp; - - if (VIR_ALLOC(vnc) < 0) - goto cleanup; - vnc->type =3D VIR_DOMAIN_GRAPHICS_TYPE_VNC; - - if (STRPREFIX(val, "unix:")) { - /* -vnc unix:/some/big/path */ - if (virDomainGraphicsListenAppendSocket(vnc, val + 5) < 0) - goto cleanup; - } else { - /* - * -vnc 127.0.0.1:4 - * -vnc [2001:1:2:3:4:5:1234:1234]:4 - * -vnc some.host.name:4 - */ - char *opts; - char *port; - const char *sep =3D ":"; - if (val[0] =3D=3D '[') - sep =3D "]:"; - tmp =3D strstr(val, sep); - if (!tmp) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing VNC port number in '%s'"), val); - goto cleanup; - } - port =3D tmp + strlen(sep); - if (virStrToLong_i(port, &opts, 10, - &vnc->data.vnc.port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse VNC port '%s'"), port); - goto cleanup; - } - if (val[0] =3D=3D '[') - val++; - if (VIR_STRNDUP(listenAddr, val, tmp-val) < 0 || - virDomainGraphicsListenAppendAddress(vnc, listenAddr) < 0) - goto cleanup; - - if (*opts =3D=3D ',') { - char *orig_opts; - - if (VIR_STRDUP(orig_opts, opts + 1) < 0) - goto cleanup; - opts =3D orig_opts; - - while (opts && *opts) { - char *nextopt =3D strchr(opts, ','); - if (nextopt) - *(nextopt++) =3D '\0'; - - if (STRPREFIX(opts, "websocket")) { - char *websocket =3D opts + strlen("websocket"); - if (*(websocket++) =3D=3D '=3D' && - *websocket) { - /* If the websocket continues with - * '=3D', we'll parse it */ - if (virStrToLong_i(websocket, - NULL, 0, - &vnc->data.vnc.websocket) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse VNC " - "WebSocket port '%s'"), - websocket); - VIR_FREE(orig_opts); - goto cleanup; - } - } else { - /* Otherwise, we'll compute the port the same - * way QEMU does, by adding a 5700 to the - * display value. */ - vnc->data.vnc.websocket =3D - vnc->data.vnc.port + 5700; - } - } else if (STRPREFIX(opts, "share=3D")) { - char *sharePolicy =3D opts + strlen("share=3D"); - if (sharePolicy && *sharePolicy) { - int policy =3D - virDomainGraphicsVNCSharePolicyTypeFromString(= sharePolicy); - - if (policy < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown vnc display sharing = policy '%s'"), - sharePolicy); - VIR_FREE(orig_opts); - goto cleanup; - } else { - vnc->data.vnc.sharePolicy =3D policy; - } - } else { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing vnc sharing policy")); - VIR_FREE(orig_opts); - goto cleanup; - } - } - - opts =3D nextopt; - } - VIR_FREE(orig_opts); - } - vnc->data.vnc.port +=3D 5900; - vnc->data.vnc.autoport =3D false; - } - - if (VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, vnc) < 0) - goto cleanup; - - ret =3D 0; - - cleanup: - virDomainGraphicsDefFree(vnc); - VIR_FREE(listenAddr); - return ret; -} - - -/* - * Tries to parse new style QEMU -drive args. - * - * eg -drive file=3D/dev/HostVG/VirtData1,if=3Dide,index=3D1 - * - * Will fail if not using the 'index' keyword - */ -static virDomainDiskDefPtr -qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt, - const char *val, - virDomainDefPtr dom, - int nvirtiodisk, - bool old_style_ceph_args) -{ - virDomainDiskDefPtr def =3D NULL; - char **keywords; - char **values; - int nkeywords; - size_t i; - int idx =3D -1; - int busid =3D -1; - int unitid =3D -1; - - if (qemuParseKeywords(val, - &keywords, - &values, - &nkeywords, - 0) < 0) - return NULL; - - if (!(def =3D virDomainDiskDefNew(xmlopt))) - goto cleanup; - - if (qemuDomainIsPSeries(dom)) - def->bus =3D VIR_DOMAIN_DISK_BUS_SCSI; - else - def->bus =3D VIR_DOMAIN_DISK_BUS_IDE; - def->device =3D VIR_DOMAIN_DISK_DEVICE_DISK; - def->src->type =3D VIR_STORAGE_TYPE_FILE; - - for (i =3D 0; i < nkeywords; i++) { - if (STREQ(keywords[i], "file")) { - if (values[i] && STRNEQ(values[i], "")) { - def->src->path =3D values[i]; - values[i] =3D NULL; - if (STRPREFIX(def->src->path, "/dev/")) - def->src->type =3D VIR_STORAGE_TYPE_BLOCK; - else if (STRPREFIX(def->src->path, "nbd:") || - STRPREFIX(def->src->path, "nbd+")) { - def->src->type =3D VIR_STORAGE_TYPE_NETWORK; - def->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_NBD; - - if (qemuParseNBDString(def) < 0) - goto error; - } else if (STRPREFIX(def->src->path, "rbd:")) { - char *p =3D def->src->path; - - def->src->type =3D VIR_STORAGE_TYPE_NETWORK; - def->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_RBD; - if (VIR_STRDUP(def->src->path, p + strlen("rbd:")) < 0) - goto error; - /* old-style CEPH_ARGS env variable is parsed later */ - if (!old_style_ceph_args && qemuParseRBDString(def) < = 0) { - VIR_FREE(p); - goto error; - } - - VIR_FREE(p); - } else if (STRPREFIX(def->src->path, "gluster:") || - STRPREFIX(def->src->path, "gluster+")) { - def->src->type =3D VIR_STORAGE_TYPE_NETWORK; - def->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_GLUSTE= R; - - if (qemuParseGlusterString(def) < 0) - goto error; - } else if (STRPREFIX(def->src->path, "iscsi:")) { - def->src->type =3D VIR_STORAGE_TYPE_NETWORK; - def->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_ISCSI; - - if (qemuParseISCSIString(def) < 0) - goto error; - } else if (STRPREFIX(def->src->path, "sheepdog:")) { - char *p =3D def->src->path; - char *port, *vdi; - - def->src->type =3D VIR_STORAGE_TYPE_NETWORK; - def->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_SHEEPD= OG; - if (VIR_STRDUP(def->src->path, p + strlen("sheepdog:")= ) < 0) - goto error; - VIR_FREE(p); - - /* def->src->path must be [vdiname] or [host]:[port]:[= vdiname] */ - port =3D strchr(def->src->path, ':'); - if (port) { - *port =3D '\0'; - vdi =3D strchr(port + 1, ':'); - if (!vdi) { - *port =3D ':'; - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse sheepdog filena= me '%s'"), - def->src->path); - goto error; - } - port++; - *vdi++ =3D '\0'; - if (VIR_ALLOC(def->src->hosts) < 0) - goto error; - def->src->nhosts =3D 1; - def->src->hosts->name =3D def->src->path; - if (virStringParsePort(port, &def->src->hosts->por= t) < 0) - goto error; - def->src->hosts->transport =3D VIR_STORAGE_NET_HOS= T_TRANS_TCP; - def->src->hosts->socket =3D NULL; - if (VIR_STRDUP(def->src->path, vdi) < 0) - goto error; - } - } else if (STRPREFIX(def->src->path, "vxhs:")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("VxHS protocol does not support URI s= yntax '%s'"), - def->src->path); - goto error; - } else { - def->src->type =3D VIR_STORAGE_TYPE_FILE; - } - } else { - def->src->type =3D VIR_STORAGE_TYPE_FILE; - } - } else if (STREQ(keywords[i], "if")) { - if (STREQ(values[i], "ide")) { - def->bus =3D VIR_DOMAIN_DISK_BUS_IDE; - if (qemuDomainIsPSeries(dom)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("pseries systems do not support ide d= evices '%s'"), val); - goto error; - } - } else if (STREQ(values[i], "scsi")) { - def->bus =3D VIR_DOMAIN_DISK_BUS_SCSI; - } else if (STREQ(values[i], "floppy")) { - def->bus =3D VIR_DOMAIN_DISK_BUS_FDC; - def->device =3D VIR_DOMAIN_DISK_DEVICE_FLOPPY; - } else if (STREQ(values[i], "virtio")) { - def->bus =3D VIR_DOMAIN_DISK_BUS_VIRTIO; - } else if (STREQ(values[i], "xen")) { - def->bus =3D VIR_DOMAIN_DISK_BUS_XEN; - } else if (STREQ(values[i], "sd")) { - def->bus =3D VIR_DOMAIN_DISK_BUS_SD; - } - } else if (STREQ(keywords[i], "media")) { - if (STREQ(values[i], "cdrom")) { - def->device =3D VIR_DOMAIN_DISK_DEVICE_CDROM; - def->src->readonly =3D true; - } else if (STREQ(values[i], "floppy")) { - def->device =3D VIR_DOMAIN_DISK_DEVICE_FLOPPY; - } - } else if (STREQ(keywords[i], "format")) { - if (virDomainDiskSetDriver(def, "qemu") < 0) - goto error; - def->src->format =3D virStorageFileFormatTypeFromString(values= [i]); - } else if (STREQ(keywords[i], "cache")) { - if (STREQ(values[i], "off") || - STREQ(values[i], "none")) - def->cachemode =3D VIR_DOMAIN_DISK_CACHE_DISABLE; - else if (STREQ(values[i], "writeback") || - STREQ(values[i], "on")) - def->cachemode =3D VIR_DOMAIN_DISK_CACHE_WRITEBACK; - else if (STREQ(values[i], "writethrough")) - def->cachemode =3D VIR_DOMAIN_DISK_CACHE_WRITETHRU; - else if (STREQ(values[i], "directsync")) - def->cachemode =3D VIR_DOMAIN_DISK_CACHE_DIRECTSYNC; - else if (STREQ(values[i], "unsafe")) - def->cachemode =3D VIR_DOMAIN_DISK_CACHE_UNSAFE; - } else if (STREQ(keywords[i], "werror")) { - if (STREQ(values[i], "stop")) - def->error_policy =3D VIR_DOMAIN_DISK_ERROR_POLICY_STOP; - else if (STREQ(values[i], "report")) - def->error_policy =3D VIR_DOMAIN_DISK_ERROR_POLICY_REPORT; - else if (STREQ(values[i], "ignore")) - def->error_policy =3D VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE; - else if (STREQ(values[i], "enospc")) - def->error_policy =3D VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPAC= E; - } else if (STREQ(keywords[i], "rerror")) { - if (STREQ(values[i], "stop")) - def->rerror_policy =3D VIR_DOMAIN_DISK_ERROR_POLICY_STOP; - else if (STREQ(values[i], "report")) - def->rerror_policy =3D VIR_DOMAIN_DISK_ERROR_POLICY_REPORT; - else if (STREQ(values[i], "ignore")) - def->rerror_policy =3D VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE; - } else if (STREQ(keywords[i], "index")) { - if (virStrToLong_i(values[i], NULL, 10, &idx) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse drive index '%s'"), val); - goto error; - } - } else if (STREQ(keywords[i], "bus")) { - if (virStrToLong_i(values[i], NULL, 10, &busid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse drive bus '%s'"), val); - goto error; - } - } else if (STREQ(keywords[i], "unit")) { - if (virStrToLong_i(values[i], NULL, 10, &unitid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse drive unit '%s'"), val); - goto error; - } - } else if (STREQ(keywords[i], "readonly")) { - if ((values[i] =3D=3D NULL) || STREQ(values[i], "on")) - def->src->readonly =3D true; - } else if (STREQ(keywords[i], "aio")) { - if ((def->iomode =3D virDomainDiskIoTypeFromString(values[i]))= < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse io mode '%s'"), values[i]); - goto error; - } - } else if (STREQ(keywords[i], "cyls")) { - if (virStrToLong_ui(values[i], NULL, 10, - &(def->geometry.cylinders)) < 0) { - virDomainDiskDefFree(def); - def =3D NULL; - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse cylinders value'%s'"), - values[i]); - goto error; - } - } else if (STREQ(keywords[i], "heads")) { - if (virStrToLong_ui(values[i], NULL, 10, - &(def->geometry.heads)) < 0) { - virDomainDiskDefFree(def); - def =3D NULL; - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse heads value'%s'"), - values[i]); - goto error; - } - } else if (STREQ(keywords[i], "secs")) { - if (virStrToLong_ui(values[i], NULL, 10, - &(def->geometry.sectors)) < 0) { - virDomainDiskDefFree(def); - def =3D NULL; - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse sectors value'%s'"), - values[i]); - goto error; - } - } else if (STREQ(keywords[i], "trans")) { - def->geometry.trans =3D - virDomainDiskGeometryTransTypeFromString(values[i]); - if ((def->geometry.trans < VIR_DOMAIN_DISK_TRANS_DEFAULT) || - (def->geometry.trans >=3D VIR_DOMAIN_DISK_TRANS_LAST)) { - virDomainDiskDefFree(def); - def =3D NULL; - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse translation value '%s'"), - values[i]); - goto error; - } - } - } - - if (def->rerror_policy =3D=3D def->error_policy) - def->rerror_policy =3D 0; - - if (!def->src->path && - def->device =3D=3D VIR_DOMAIN_DISK_DEVICE_DISK && - def->src->type !=3D VIR_STORAGE_TYPE_NETWORK) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing file parameter in drive '%s'"), val); - goto error; - } - if (idx =3D=3D -1 && - def->bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO) - idx =3D nvirtiodisk; - - if (idx =3D=3D -1 && - unitid =3D=3D -1 && - busid =3D=3D -1) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("missing index/unit/bus parameter in drive '%s'"), - val); - goto error; - } - - if (idx =3D=3D -1) { - if (unitid =3D=3D -1) - unitid =3D 0; - if (busid =3D=3D -1) - busid =3D 0; - switch (def->bus) { - case VIR_DOMAIN_DISK_BUS_IDE: - idx =3D (busid * 2) + unitid; - break; - case VIR_DOMAIN_DISK_BUS_SCSI: - idx =3D (busid * 7) + unitid; - break; - default: - idx =3D unitid; - break; - } - } - - if (def->bus =3D=3D VIR_DOMAIN_DISK_BUS_IDE) { - ignore_value(VIR_STRDUP(def->dst, "hda")); - } else if (def->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI || - def->bus =3D=3D VIR_DOMAIN_DISK_BUS_SD) { - ignore_value(VIR_STRDUP(def->dst, "sda")); - } else if (def->bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { - ignore_value(VIR_STRDUP(def->dst, "vda")); - } else if (def->bus =3D=3D VIR_DOMAIN_DISK_BUS_XEN) { - ignore_value(VIR_STRDUP(def->dst, "xvda")); - } else if (def->bus =3D=3D VIR_DOMAIN_DISK_BUS_FDC) { - ignore_value(VIR_STRDUP(def->dst, "fda")); - } else { - ignore_value(VIR_STRDUP(def->dst, "hda")); - } - - if (!def->dst) - goto error; - if (STREQ(def->dst, "xvda")) - def->dst[3] =3D 'a' + idx; - else - def->dst[2] =3D 'a' + idx; - - if (virDomainDiskDefAssignAddress(xmlopt, def, dom) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("invalid device name '%s'"), def->dst); - goto error; - } - - cleanup: - qemuParseKeywordsFree(nkeywords, keywords, values); - return def; - - error: - virDomainDiskDefFree(def); - def =3D NULL; - goto cleanup; -} - -/* - * Tries to find a NIC definition matching a vlan we want - */ -static const char * -qemuFindNICForVLAN(int nnics, - const char **nics, - int wantvlan) -{ - size_t i; - for (i =3D 0; i < nnics; i++) { - int gotvlan; - const char *tmp =3D strstr(nics[i], "vlan=3D"); - char *end; - if (!tmp) - continue; - - tmp +=3D strlen("vlan=3D"); - - if (virStrToLong_i(tmp, &end, 10, &gotvlan) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse NIC vlan in '%s'"), nics[i]); - return NULL; - } - - if (gotvlan =3D=3D wantvlan) - return nics[i]; - } - - if (wantvlan =3D=3D 0 && nnics > 0) - return nics[0]; - - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find NIC definition for vlan %d"), wantvlan); - return NULL; -} - - -/* - * Tries to parse a QEMU -net backend argument. Gets given - * a list of all known -net frontend arguments to try and - * match up against. Horribly complicated stuff - */ -static virDomainNetDefPtr -qemuParseCommandLineNet(virDomainXMLOptionPtr xmlopt, - const char *val, - int nnics, - const char **nics) -{ - virDomainNetDefPtr def =3D NULL; - char **keywords =3D NULL; - char **values =3D NULL; - int nkeywords; - const char *nic; - int wantvlan =3D 0; - const char *tmp; - bool genmac =3D true; - size_t i; - - tmp =3D strchr(val, ','); - - if (tmp) { - if (qemuParseKeywords(tmp+1, - &keywords, - &values, - &nkeywords, - 0) < 0) - return NULL; - } else { - nkeywords =3D 0; - } - - if (VIR_ALLOC(def) < 0) - goto cleanup; - - /* 'tap' could turn into libvirt type=3Dethernet, type=3Dbridge or - * type=3Dnetwork, but we can't tell, so use the generic config */ - if (STRPREFIX(val, "tap,")) - def->type =3D VIR_DOMAIN_NET_TYPE_ETHERNET; - else if (STRPREFIX(val, "socket")) - def->type =3D VIR_DOMAIN_NET_TYPE_CLIENT; - else if (STRPREFIX(val, "user")) - def->type =3D VIR_DOMAIN_NET_TYPE_USER; - else - def->type =3D VIR_DOMAIN_NET_TYPE_ETHERNET; - - for (i =3D 0; i < nkeywords; i++) { - if (STREQ(keywords[i], "vlan")) { - if (virStrToLong_i(values[i], NULL, 10, &wantvlan) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vlan in '%s'"), val); - goto error; - } - } else if (def->type =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET && - STREQ(keywords[i], "script") && STRNEQ(values[i], "")) { - def->script =3D values[i]; - values[i] =3D NULL; - } else if (def->type =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET && - STREQ(keywords[i], "ifname")) { - def->ifname =3D values[i]; - values[i] =3D NULL; - } - } - - - /* Done parsing the nic backend. Now to try and find corresponding - * frontend, based off vlan number. NB this assumes a 1-1 mapping - */ - - nic =3D qemuFindNICForVLAN(nnics, nics, wantvlan); - if (!nic) - goto error; - - if (!STRPREFIX(nic, "nic")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse NIC definition '%s'"), nic); - goto error; - } - - for (i =3D 0; i < nkeywords; i++) { - VIR_FREE(keywords[i]); - VIR_FREE(values[i]); - } - VIR_FREE(keywords); - VIR_FREE(values); - - if (STRPREFIX(nic, "nic,")) { - if (qemuParseKeywords(nic + strlen("nic,"), - &keywords, - &values, - &nkeywords, - 0) < 0) { - goto error; - } - } else { - nkeywords =3D 0; - } - - for (i =3D 0; i < nkeywords; i++) { - if (STREQ(keywords[i], "macaddr")) { - genmac =3D false; - if (virMacAddrParse(values[i], &def->mac) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to parse mac address '%s'"), - values[i]); - goto error; - } - } else if (STREQ(keywords[i], "model")) { - if (virDomainNetSetModelString(def, values[i]) < 0) - goto error; - VIR_FREE(values[i]); - } else if (STREQ(keywords[i], "vhost")) { - if ((values[i] =3D=3D NULL) || STREQ(values[i], "on")) { - def->driver.virtio.name =3D VIR_DOMAIN_NET_BACKEND_TYPE_VH= OST; - } else if (STREQ(keywords[i], "off")) { - def->driver.virtio.name =3D VIR_DOMAIN_NET_BACKEND_TYPE_QE= MU; - } - } else if (STREQ(keywords[i], "sndbuf") && values[i]) { - if (virStrToLong_ul(values[i], NULL, 10, &def->tune.sndbuf) < = 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse sndbuf size in '%s'"), val); - goto error; - } - def->tune.sndbuf_specified =3D true; - } - } - - if (genmac) - virDomainNetGenerateMAC(xmlopt, &def->mac); - - cleanup: - qemuParseKeywordsFree(nkeywords, keywords, values); - return def; - - error: - virDomainNetDefFree(def); - def =3D NULL; - goto cleanup; -} - - -/* - * Tries to parse a QEMU PCI device - */ -static virDomainHostdevDefPtr -qemuParseCommandLinePCI(const char *val) -{ - int bus =3D 0, slot =3D 0, func =3D 0; - const char *start; - char *end; - virDomainHostdevDefPtr def =3D virDomainHostdevDefNew(); - - if (!def) - goto error; - - if (!STRPREFIX(val, "host=3D")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown PCI device syntax '%s'"), val); - goto error; - } - - start =3D val + strlen("host=3D"); - if (virStrToLong_i(start, &end, 16, &bus) < 0 || *end !=3D ':') { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract PCI device bus '%s'"), val); - goto error; - } - start =3D end + 1; - if (virStrToLong_i(start, &end, 16, &slot) < 0 || *end !=3D '.') { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract PCI device slot '%s'"), val); - goto error; - } - start =3D end + 1; - if (virStrToLong_i(start, NULL, 16, &func) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract PCI device function '%s'"), val); - goto error; - } - - def->mode =3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; - def->managed =3D true; - def->source.subsys.type =3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; - def->source.subsys.u.pci.addr.bus =3D bus; - def->source.subsys.u.pci.addr.slot =3D slot; - def->source.subsys.u.pci.addr.function =3D func; - return def; - - error: - virDomainHostdevDefFree(def); - return NULL; -} - - -/* - * Tries to parse a QEMU USB device - */ -static virDomainHostdevDefPtr -qemuParseCommandLineUSB(const char *val) -{ - virDomainHostdevDefPtr def =3D virDomainHostdevDefNew(); - virDomainHostdevSubsysUSBPtr usbsrc; - int first =3D 0, second =3D 0; - const char *start; - char *end; - - if (!def) - goto error; - usbsrc =3D &def->source.subsys.u.usb; - - if (!STRPREFIX(val, "host:")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown USB device syntax '%s'"), val); - goto error; - } - - start =3D val + strlen("host:"); - if (strchr(start, ':')) { - if (virStrToLong_i(start, &end, 16, &first) < 0 || *end !=3D ':') { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device vendor '%s'"), val= ); - goto error; - } - start =3D end + 1; - if (virStrToLong_i(start, NULL, 16, &second) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device product '%s'"), va= l); - goto error; - } - } else { - if (virStrToLong_i(start, &end, 10, &first) < 0 || *end !=3D '.') { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device bus '%s'"), val); - goto error; - } - start =3D end + 1; - if (virStrToLong_i(start, NULL, 10, &second) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot extract USB device address '%s'"), va= l); - goto error; - } - } - - def->mode =3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; - def->managed =3D false; - def->source.subsys.type =3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB; - if (*end =3D=3D '.') { - usbsrc->bus =3D first; - usbsrc->device =3D second; - } else { - usbsrc->vendor =3D first; - usbsrc->product =3D second; - } - return def; - - error: - virDomainHostdevDefFree(def); - return NULL; -} - - -/* - * Tries to parse a QEMU serial/parallel device - */ -static int -qemuParseCommandLineChr(virDomainChrSourceDefPtr source, - const char *val) -{ - if (STREQ(val, "null")) { - source->type =3D VIR_DOMAIN_CHR_TYPE_NULL; - } else if (STREQ(val, "vc")) { - source->type =3D VIR_DOMAIN_CHR_TYPE_VC; - } else if (STREQ(val, "pty")) { - source->type =3D VIR_DOMAIN_CHR_TYPE_PTY; - } else if (STRPREFIX(val, "file:")) { - source->type =3D VIR_DOMAIN_CHR_TYPE_FILE; - if (VIR_STRDUP(source->data.file.path, val + strlen("file:")) < 0) - goto error; - } else if (STRPREFIX(val, "pipe:")) { - source->type =3D VIR_DOMAIN_CHR_TYPE_PIPE; - if (VIR_STRDUP(source->data.file.path, val + strlen("pipe:")) < 0) - goto error; - } else if (STREQ(val, "stdio")) { - source->type =3D VIR_DOMAIN_CHR_TYPE_STDIO; - } else if (STRPREFIX(val, "udp:")) { - const char *svc1, *host2, *svc2; - source->type =3D VIR_DOMAIN_CHR_TYPE_UDP; - val +=3D strlen("udp:"); - svc1 =3D strchr(val, ':'); - host2 =3D svc1 ? strchr(svc1, '@') : NULL; - svc2 =3D host2 ? strchr(host2, ':') : NULL; - - if (svc1 && svc1 !=3D val && - VIR_STRNDUP(source->data.udp.connectHost, val, svc1 - val) < 0) - goto error; - - if (svc1) { - svc1++; - if (VIR_STRNDUP(source->data.udp.connectService, svc1, - host2 ? host2 - svc1 : strlen(svc1)) < 0) - goto error; - } - - if (host2) { - host2++; - if (svc2 && svc2 !=3D host2 && - VIR_STRNDUP(source->data.udp.bindHost, host2, svc2 - host2= ) < 0) - goto error; - } - - if (svc2) { - svc2++; - if (STRNEQ(svc2, "0")) { - if (VIR_STRDUP(source->data.udp.bindService, svc2) < 0) - goto error; - } - } - } else if (STRPREFIX(val, "tcp:") || - STRPREFIX(val, "telnet:")) { - const char *opt, *svc; - source->type =3D VIR_DOMAIN_CHR_TYPE_TCP; - if (STRPREFIX(val, "tcp:")) { - val +=3D strlen("tcp:"); - } else { - val +=3D strlen("telnet:"); - source->data.tcp.protocol =3D VIR_DOMAIN_CHR_TCP_PROTOCOL_TELN= ET; - } - svc =3D strchr(val, ':'); - if (!svc) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot find port number in character device = %s"), val); - goto error; - } - opt =3D strchr(svc, ','); - if (opt && strstr(opt, "server")) - source->data.tcp.listen =3D true; - - if (VIR_STRNDUP(source->data.tcp.host, val, svc - val) < 0) - goto error; - svc++; - if (VIR_STRNDUP(source->data.tcp.service, svc, opt ? opt - svc : -= 1) < 0) - goto error; - } else if (STRPREFIX(val, "unix:")) { - const char *opt; - val +=3D strlen("unix:"); - opt =3D strchr(val, ','); - source->type =3D VIR_DOMAIN_CHR_TYPE_UNIX; - if (VIR_STRNDUP(source->data.nix.path, val, opt ? opt - val : -1) = < 0) - goto error; - - } else if (STRPREFIX(val, "/dev")) { - source->type =3D VIR_DOMAIN_CHR_TYPE_DEV; - if (VIR_STRDUP(source->data.file.path, val) < 0) - goto error; - } else { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown character device syntax %s"), val); - goto error; - } - - return 0; - - error: - return -1; -} - - -static virCPUDefPtr -qemuInitGuestCPU(virDomainDefPtr dom) -{ - if (!dom->cpu) { - virCPUDefPtr cpu; - - if (VIR_ALLOC(cpu) < 0) - return NULL; - - cpu->type =3D VIR_CPU_TYPE_GUEST; - cpu->match =3D VIR_CPU_MATCH_EXACT; - dom->cpu =3D cpu; - } - - return dom->cpu; -} - - -static int -qemuParseCommandLineCPU(virDomainDefPtr dom, - const char *val) -{ - virCPUDefPtr cpu =3D NULL; - char **tokens; - char **hv_tokens =3D NULL; - char *model =3D NULL; - int ret =3D -1; - size_t i; - - if (!(tokens =3D virStringSplit(val, ",", 0))) - goto cleanup; - - if (tokens[0] =3D=3D NULL) - goto syntax; - - for (i =3D 0; tokens[i] !=3D NULL; i++) { - if (*tokens[i] =3D=3D '\0') - goto syntax; - - if (i =3D=3D 0) { - if (VIR_STRDUP(model, tokens[i]) < 0) - goto cleanup; - - if (STRNEQ(model, "qemu32") && STRNEQ(model, "qemu64")) { - if (!(cpu =3D qemuInitGuestCPU(dom))) - goto cleanup; - - cpu->model =3D model; - model =3D NULL; - } - } else if (*tokens[i] =3D=3D '+' || *tokens[i] =3D=3D '-') { - const char *feature =3D tokens[i] + 1; /* '+' or '-' */ - int policy; - - if (*tokens[i] =3D=3D '+') - policy =3D VIR_CPU_FEATURE_REQUIRE; - else - policy =3D VIR_CPU_FEATURE_DISABLE; - - if (*feature =3D=3D '\0') - goto syntax; - - if (!ARCH_IS_X86(dom->os.arch)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s platform doesn't support CPU features= '"), - virArchToString(dom->os.arch)); - goto cleanup; - } - - if (STREQ(feature, "kvmclock")) { - bool present =3D (policy =3D=3D VIR_CPU_FEATURE_REQUIRE); - size_t j; - - for (j =3D 0; j < dom->clock.ntimers; j++) { - if (dom->clock.timers[j]->name =3D=3D VIR_DOMAIN_TIMER= _NAME_KVMCLOCK) - break; - } - - if (j =3D=3D dom->clock.ntimers) { - virDomainTimerDefPtr timer; - if (VIR_ALLOC(timer) < 0 || - VIR_APPEND_ELEMENT_COPY(dom->clock.timers, - dom->clock.ntimers, timer)= < 0) { - VIR_FREE(timer); - goto cleanup; - } - timer->name =3D VIR_DOMAIN_TIMER_NAME_KVMCLOCK; - timer->present =3D present; - timer->tickpolicy =3D -1; - timer->track =3D -1; - timer->mode =3D -1; - } else if (dom->clock.timers[j]->present !=3D -1 && - dom->clock.timers[j]->present !=3D present) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("conflicting occurrences of kvmclock = feature")); - goto cleanup; - } - } else if (STREQ(feature, "kvm_pv_eoi")) { - if (policy =3D=3D VIR_CPU_FEATURE_REQUIRE) - dom->apic_eoi =3D VIR_TRISTATE_SWITCH_ON; - else - dom->apic_eoi =3D VIR_TRISTATE_SWITCH_OFF; - } else { - if (!cpu) { - if (!(cpu =3D qemuInitGuestCPU(dom))) - goto cleanup; - - cpu->model =3D model; - model =3D NULL; - } - - if (virCPUDefAddFeature(cpu, feature, policy) < 0) - goto cleanup; - } - } else if (STREQ(tokens[i], "hv_crash")) { - size_t j; - for (j =3D 0; j < dom->npanics; j++) { - if (dom->panics[j]->model =3D=3D VIR_DOMAIN_PANIC_MODEL_H= YPERV) - break; - } - - if (j =3D=3D dom->npanics) { - virDomainPanicDefPtr panic; - if (VIR_ALLOC(panic) < 0 || - VIR_APPEND_ELEMENT_COPY(dom->panics, - dom->npanics, panic) < 0) { - VIR_FREE(panic); - goto cleanup; - } - panic->model =3D VIR_DOMAIN_PANIC_MODEL_HYPERV; - } - } else if (STRPREFIX(tokens[i], "hv_")) { - const char *token =3D tokens[i] + 3; /* "hv_" */ - const char *feature, *value; - int f; - - if (*token =3D=3D '\0') - goto syntax; - - if (!(hv_tokens =3D virStringSplit(token, "=3D", 2))) - goto cleanup; - - feature =3D hv_tokens[0]; - value =3D hv_tokens[1]; - - if (*feature =3D=3D '\0') - goto syntax; - - dom->features[VIR_DOMAIN_FEATURE_HYPERV] =3D VIR_TRISTATE_SWIT= CH_ON; - - if ((f =3D virDomainHypervTypeFromString(feature)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported HyperV Enlightenment feature= " - "'%s'"), feature); - goto cleanup; - } - - switch ((virDomainHyperv) f) { - case VIR_DOMAIN_HYPERV_RELAXED: - case VIR_DOMAIN_HYPERV_VAPIC: - case VIR_DOMAIN_HYPERV_VPINDEX: - case VIR_DOMAIN_HYPERV_RUNTIME: - case VIR_DOMAIN_HYPERV_SYNIC: - case VIR_DOMAIN_HYPERV_STIMER: - case VIR_DOMAIN_HYPERV_RESET: - case VIR_DOMAIN_HYPERV_FREQUENCIES: - case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: - case VIR_DOMAIN_HYPERV_TLBFLUSH: - case VIR_DOMAIN_HYPERV_IPI: - case VIR_DOMAIN_HYPERV_EVMCS: - if (value) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("HyperV feature '%s' should not " - "have a value"), feature); - goto cleanup; - } - dom->hyperv_features[f] =3D VIR_TRISTATE_SWITCH_ON; - break; - - case VIR_DOMAIN_HYPERV_SPINLOCKS: - dom->hyperv_features[f] =3D VIR_TRISTATE_SWITCH_ON; - if (!value) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("missing HyperV spinlock retry count"= )); - goto cleanup; - } - - if (virStrToLong_ui(value, NULL, 0, &dom->hyperv_spinlocks= ) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("cannot parse HyperV spinlock retry c= ount")); - goto cleanup; - } - - if (dom->hyperv_spinlocks < 0xFFF) - dom->hyperv_spinlocks =3D 0xFFF; - break; - - case VIR_DOMAIN_HYPERV_VENDOR_ID: - dom->hyperv_features[f] =3D VIR_TRISTATE_SWITCH_ON; - if (!value) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("missing HyperV vendor_id value")); - goto cleanup; - } - - if (VIR_STRDUP(dom->hyperv_vendor_id, value) < 0) - goto cleanup; - - break; - - case VIR_DOMAIN_HYPERV_LAST: - break; - } - virStringListFree(hv_tokens); - hv_tokens =3D NULL; - } else if (STREQ(tokens[i], "kvm=3Doff")) { - dom->features[VIR_DOMAIN_FEATURE_KVM] =3D VIR_TRISTATE_SWITCH= _ON; - dom->kvm_features[VIR_DOMAIN_KVM_HIDDEN] =3D VIR_TRISTATE_SWI= TCH_ON; - } - } - - if (dom->os.arch =3D=3D VIR_ARCH_X86_64) { - bool is_32bit =3D false; - if (cpu) { - virCPUDataPtr cpuData =3D NULL; - - if (cpuEncode(VIR_ARCH_X86_64, cpu, NULL, &cpuData, - NULL, NULL, NULL, NULL) < 0) - goto cleanup; - - is_32bit =3D (virCPUDataCheckFeature(cpuData, "lm") !=3D 1); - virCPUDataFree(cpuData); - } else if (model) { - is_32bit =3D STREQ(model, "qemu32"); - } - - if (is_32bit) - dom->os.arch =3D VIR_ARCH_I686; - } - - ret =3D 0; - - cleanup: - VIR_FREE(model); - virStringListFree(tokens); - virStringListFree(hv_tokens); - return ret; - - syntax: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown CPU syntax '%s'"), val); - goto cleanup; -} - - -static int -qemuParseCommandLineMem(virDomainDefPtr dom, - const char *val) -{ - unsigned long long mem =3D 0; - unsigned long long size =3D 0; - unsigned long long maxmem =3D 0; - unsigned int slots =3D 0; - char *end; - size_t i; - int nkws; - char **kws; - char **vals; - int n; - int ret =3D -1; - - if (qemuParseKeywords(val, &kws, &vals, &nkws, 1) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse memory '%s'"), val); - goto cleanup; - } - - for (i =3D 0; i < nkws; i++) { - if (vals[i] =3D=3D NULL) { - if (i > 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse memory '%s'"), val); - goto cleanup; - } - if (virStrToLong_ull(kws[i], &end, 10, &mem) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse memory value '%s'"), kws[i]= ); - goto cleanup; - } - if (virScaleInteger(&mem, end, 1024*1024, ULLONG_MAX) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot scale memory: %s"), - virGetLastErrorMessage()); - goto cleanup; - } - - size =3D mem; - - } else { - if (STREQ(kws[i], "size") || STREQ(kws[i], "maxmem")) { - if (virStrToLong_ull(vals[i], &end, 10, &mem) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse memory value '%s'"), va= ls[i]); - goto cleanup; - } - if (virScaleInteger(&mem, end, 1024*1024, ULLONG_MAX) < 0)= { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot scale memory: %s"), - virGetLastErrorMessage()); - goto cleanup; - } - - STREQ(kws[i], "size") ? (size =3D mem) : (maxmem =3D mem); - - } - if (STREQ(kws[i], "slots")) { - if (virStrToLong_i(vals[i], &end, 10, &n) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse slots value '%s'"), val= s[i]); - goto cleanup; - } - - slots =3D n; - - } - } - } - - virDomainDefSetMemoryTotal(dom, size / 1024); - dom->mem.cur_balloon =3D size / 1024; - dom->mem.memory_slots =3D slots; - dom->mem.max_memory =3D maxmem / 1024; - - ret =3D 0; - - cleanup: - qemuParseKeywordsFree(nkws, kws, vals); - return ret; -} - - -static int -qemuParseCommandLineSmp(virDomainDefPtr dom, - const char *val, - virDomainXMLOptionPtr xmlopt) -{ - unsigned int sockets =3D 0; - unsigned int cores =3D 0; - unsigned int threads =3D 0; - unsigned int maxcpus =3D 0; - unsigned int vcpus =3D 0; - size_t i; - int nkws; - char **kws; - char **vals; - int n; - char *end; - int ret; - - if (qemuParseKeywords(val, &kws, &vals, &nkws, 1) < 0) - return -1; - - for (i =3D 0; i < nkws; i++) { - if (vals[i] =3D=3D NULL) { - if (i > 0 || - virStrToLong_ui(kws[i], &end, 10, &vcpus) < 0 || *end !=3D= '\0') - goto syntax; - } else { - if (virStrToLong_i(vals[i], &end, 10, &n) < 0 || *end !=3D '\0= ') - goto syntax; - if (STREQ(kws[i], "sockets")) - sockets =3D n; - else if (STREQ(kws[i], "cores")) - cores =3D n; - else if (STREQ(kws[i], "threads")) - threads =3D n; - else if (STREQ(kws[i], "maxcpus")) - maxcpus =3D n; - else if (STREQ(kws[i], "cpus")) - vcpus =3D n; - else - goto syntax; - } - } - - if (sockets && cores && threads) { - virCPUDefPtr cpu; - - if (!(cpu =3D qemuInitGuestCPU(dom))) - goto error; - cpu->sockets =3D sockets; - cpu->cores =3D cores; - cpu->threads =3D threads; - } else if (sockets || cores || threads) { - goto syntax; - } - - if (maxcpus =3D=3D 0) { - if (cores) { - if (virDomainDefGetVcpusTopology(dom, &maxcpus) < 0) - goto error; - } else { - maxcpus =3D vcpus; - } - } - - if (maxcpus =3D=3D 0) - goto syntax; - - if (vcpus =3D=3D 0) - vcpus =3D maxcpus; - - if (virDomainDefSetVcpusMax(dom, maxcpus, xmlopt) < 0) - goto error; - - if (virDomainDefSetVcpus(dom, vcpus) < 0) - goto error; - - ret =3D 0; - - cleanup: - qemuParseKeywordsFree(nkws, kws, vals); - return ret; - - syntax: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse CPU topology '%s'"), val); - error: - ret =3D -1; - goto cleanup; -} - - -static void -qemuParseCommandLineBootDevs(virDomainDefPtr def, const char *str) -{ - int n, b =3D 0; - - for (n =3D 0; str[n] && b < VIR_DOMAIN_BOOT_LAST; n++) { - if (str[n] =3D=3D 'a') - def->os.bootDevs[b++] =3D VIR_DOMAIN_BOOT_FLOPPY; - else if (str[n] =3D=3D 'c') - def->os.bootDevs[b++] =3D VIR_DOMAIN_BOOT_DISK; - else if (str[n] =3D=3D 'd') - def->os.bootDevs[b++] =3D VIR_DOMAIN_BOOT_CDROM; - else if (str[n] =3D=3D 'n') - def->os.bootDevs[b++] =3D VIR_DOMAIN_BOOT_NET; - else if (str[n] =3D=3D ',') - break; - } - def->os.nBootDevs =3D b; -} - - -/* - * Analyse the env and argv settings and reconstruct a - * virDomainDefPtr representing these settings as closely - * as is practical. This is not an exact science.... - */ -static virDomainDefPtr -qemuParseCommandLine(virFileCachePtr capsCache, - virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - char **progenv, - char **progargv, - char **pidfile, - virDomainChrSourceDefPtr *monConfig, - bool *monJSON) -{ - virDomainDefPtr def =3D NULL; - size_t i; - bool nographics =3D false; - bool fullscreen =3D false; - char **list =3D NULL; - char *path; - size_t nnics =3D 0; - const char **nics =3D NULL; - int video =3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS; - int nvirtiodisk =3D 0; - qemuDomainCmdlineDefPtr cmd =3D NULL; - virDomainDiskDefPtr disk =3D NULL; - const char *ceph_args =3D qemuFindEnv(progenv, "CEPH_ARGS"); - bool have_sdl =3D false; - virQEMUCapsPtr qemuCaps =3D NULL; - - if (pidfile) - *pidfile =3D NULL; - if (monConfig) - *monConfig =3D NULL; - if (monJSON) - *monJSON =3D false; - - if (!progargv[0]) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("no emulator path found")); - return NULL; - } - - if (!(qemuCaps =3D virQEMUCapsCacheLookup(capsCache, progargv[0]))) - goto error; - - if (!(def =3D virDomainDefNew())) - goto error; - - /* allocate the cmdlinedef up-front; if it's unused, we'll free it lat= er */ - if (VIR_ALLOC(cmd) < 0) - goto error; - - if (virUUIDGenerate(def->uuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("failed to generate uuid")); - goto error; - } - - def->id =3D -1; - def->mem.cur_balloon =3D 64 * 1024; - virDomainDefSetMemoryTotal(def, def->mem.cur_balloon); - if (virDomainDefSetVcpusMax(def, 1, xmlopt) < 0) - goto error; - if (virDomainDefSetVcpus(def, 1) < 0) - goto error; - def->clock.offset =3D VIR_DOMAIN_CLOCK_OFFSET_UTC; - - def->onReboot =3D VIR_DOMAIN_LIFECYCLE_ACTION_RESTART; - def->onCrash =3D VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; - def->onPoweroff =3D VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; - def->virtType =3D VIR_DOMAIN_VIRT_QEMU; - if (VIR_STRDUP(def->emulator, progargv[0]) < 0) - goto error; - - if (!(path =3D last_component(def->emulator))) - goto error; - - def->os.type =3D VIR_DOMAIN_OSTYPE_HVM; - if (strstr(path, "kvm")) { - def->virtType =3D VIR_DOMAIN_VIRT_KVM; - def->features[VIR_DOMAIN_FEATURE_PAE] =3D VIR_TRISTATE_SWITCH_ON; - } - - if (def->virtType =3D=3D VIR_DOMAIN_VIRT_KVM) - def->os.arch =3D caps->host.arch; - else if (STRPREFIX(path, "qemu-system-")) - def->os.arch =3D virArchFromString(path + strlen("qemu-system-")); - else - def->os.arch =3D VIR_ARCH_I686; - - if (ARCH_IS_X86(def->os.arch)) - def->features[VIR_DOMAIN_FEATURE_ACPI] =3D VIR_TRISTATE_SWITCH_ON; - -#define WANT_VALUE() \ - const char *val =3D progargv[++i]; \ - if (!val) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("missing value for %s argument"), arg); \ - goto error; \ - } - - /* One initial loop to get list of NICs, so we - * can correlate them later */ - for (i =3D 1; progargv[i]; i++) { - const char *arg =3D progargv[i]; - /* Make sure we have a single - for all options to - simplify next logic */ - if (STRPREFIX(arg, "--")) - arg++; - - if (STREQ(arg, "-net")) { - WANT_VALUE(); - if (STRPREFIX(val, "nic") && - VIR_APPEND_ELEMENT(nics, nnics, val) < 0) - goto error; - } - } - - /* Detect machine type before processing any other arguments, - * because they might depend on it */ - for (i =3D 1; progargv[i]; i++) { - const char *arg =3D progargv[i]; - - /* Make sure we have a single - for all options to - simplify next logic */ - if (STRPREFIX(arg, "--")) - arg++; - - if (STREQ(arg, "-M") || - STREQ(arg, "-machine")) { - char *param; - size_t j =3D 0; - - /* -machine [type=3D]name[,prop[=3Dvalue][,...]] - * Set os.machine only if first parameter lacks '=3D' or - * contains explicit type=3D'...' */ - WANT_VALUE(); - if (!(list =3D virStringSplit(val, ",", 0))) - goto error; - param =3D list[0]; - - if (STRPREFIX(param, "type=3D")) - param +=3D strlen("type=3D"); - if (!strchr(param, '=3D')) { - if (VIR_STRDUP(def->os.machine, param) < 0) - goto error; - j++; - } - - /* handle all remaining "-machine" parameters */ - while ((param =3D list[j++])) { - if (STRPREFIX(param, "dump-guest-core=3D")) { - param +=3D strlen("dump-guest-core=3D"); - def->mem.dump_core =3D virTristateSwitchTypeFromString= (param); - if (def->mem.dump_core <=3D 0) - def->mem.dump_core =3D VIR_TRISTATE_SWITCH_ABSENT; - } else if (STRPREFIX(param, "mem-merge=3Doff")) { - def->mem.nosharepages =3D true; - } else if (STRPREFIX(param, "accel=3Dkvm")) { - def->virtType =3D VIR_DOMAIN_VIRT_KVM; - def->features[VIR_DOMAIN_FEATURE_PAE] =3D VIR_TRISTATE= _SWITCH_ON; - } else if (STRPREFIX(param, "aes-key-wrap=3D")) { - if (STREQ(arg, "-M")) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("aes-key-wrap is not supported wi= th " - "this QEMU binary")); - goto error; - } - param +=3D strlen("aes-key-wrap=3D"); - if (!def->keywrap && VIR_ALLOC(def->keywrap) < 0) - goto error; - def->keywrap->aes =3D virTristateSwitchTypeFromString(= param); - if (def->keywrap->aes < 0) - def->keywrap->aes =3D VIR_TRISTATE_SWITCH_ABSENT; - } else if (STRPREFIX(param, "dea-key-wrap=3D")) { - if (STREQ(arg, "-M")) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("dea-key-wrap is not supported wi= th " - "this QEMU binary")); - goto error; - } - param +=3D strlen("dea-key-wrap=3D"); - if (!def->keywrap && VIR_ALLOC(def->keywrap) < 0) - goto error; - def->keywrap->dea =3D virTristateSwitchTypeFromString(= param); - if (def->keywrap->dea < 0) - def->keywrap->dea =3D VIR_TRISTATE_SWITCH_ABSENT; - } - } - virStringListFree(list); - list =3D NULL; - } - } - - /* If no machine type has been found among the arguments, then figure - * out a reasonable value by using capabilities */ - if (!def->os.machine) { - const char *mach =3D virQEMUCapsGetDefaultMachine(qemuCaps); - - if (!mach) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Binary '%s' does not have a default machine = type " - "and no '-machine' arg is present"), - progargv[0]); - goto error; - } - - if (VIR_STRDUP(def->os.machine, mach) < 0) - goto error; - } - - /* Now the real processing loop */ - for (i =3D 1; progargv[i]; i++) { - const char *arg =3D progargv[i]; - bool argRecognized =3D true; - - /* Make sure we have a single - for all options to - simplify next logic */ - if (STRPREFIX(arg, "--")) - arg++; - - if (STREQ(arg, "-vnc")) { - WANT_VALUE(); - if (qemuParseCommandLineVnc(def, val) < 0) - goto error; - } else if (STREQ(arg, "-sdl")) { - have_sdl =3D true; - } else if (STREQ(arg, "-m")) { - WANT_VALUE(); - if (qemuParseCommandLineMem(def, val) < 0) - goto error; - } else if (STREQ(arg, "-smp")) { - WANT_VALUE(); - if (qemuParseCommandLineSmp(def, val, xmlopt) < 0) - goto error; - } else if (STREQ(arg, "-uuid")) { - WANT_VALUE(); - if (virUUIDParse(val, def->uuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("cannot parse UUID '%s'"), val); - goto error; - } - } else if (STRPREFIX(arg, "-hd") || - STRPREFIX(arg, "-sd") || - STRPREFIX(arg, "-fd") || - STREQ(arg, "-cdrom")) { - WANT_VALUE(); - if (!(disk =3D virDomainDiskDefNew(xmlopt))) - goto error; - - if (STRPREFIX(val, "/dev/")) { - disk->src->type =3D VIR_STORAGE_TYPE_BLOCK; - } else if (STRPREFIX(val, "nbd:")) { - disk->src->type =3D VIR_STORAGE_TYPE_NETWORK; - disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_NBD; - } else if (STRPREFIX(val, "rbd:")) { - disk->src->type =3D VIR_STORAGE_TYPE_NETWORK; - disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_RBD; - val +=3D strlen("rbd:"); - } else if (STRPREFIX(val, "gluster")) { - disk->src->type =3D VIR_STORAGE_TYPE_NETWORK; - disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_GLUSTER; - } else if (STRPREFIX(val, "sheepdog:")) { - disk->src->type =3D VIR_STORAGE_TYPE_NETWORK; - disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_SHEEPDOG; - val +=3D strlen("sheepdog:"); - } else if (STRPREFIX(val, "vxhs:")) { - disk->src->type =3D VIR_STORAGE_TYPE_NETWORK; - disk->src->protocol =3D VIR_STORAGE_NET_PROTOCOL_VXHS; - val +=3D strlen("vxhs:"); - } else { - disk->src->type =3D VIR_STORAGE_TYPE_FILE; - } - if (STREQ(arg, "-cdrom")) { - disk->device =3D VIR_DOMAIN_DISK_DEVICE_CDROM; - if (qemuDomainIsPSeries(def)) - disk->bus =3D VIR_DOMAIN_DISK_BUS_SCSI; - if (VIR_STRDUP(disk->dst, "hdc") < 0) - goto error; - disk->src->readonly =3D true; - } else { - if (STRPREFIX(arg, "-fd")) { - disk->device =3D VIR_DOMAIN_DISK_DEVICE_FLOPPY; - disk->bus =3D VIR_DOMAIN_DISK_BUS_FDC; - } else { - disk->device =3D VIR_DOMAIN_DISK_DEVICE_DISK; - if (STRPREFIX(arg, "-hd")) - disk->bus =3D VIR_DOMAIN_DISK_BUS_IDE; - else - disk->bus =3D VIR_DOMAIN_DISK_BUS_SCSI; - if (qemuDomainIsPSeries(def)) - disk->bus =3D VIR_DOMAIN_DISK_BUS_SCSI; - } - if (VIR_STRDUP(disk->dst, arg + 1) < 0) - goto error; - } - if (VIR_STRDUP(disk->src->path, val) < 0) - goto error; - - if (disk->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK) { - char *port; - - switch ((virStorageNetProtocol) disk->src->protocol) { - case VIR_STORAGE_NET_PROTOCOL_NBD: - if (qemuParseNBDString(disk) < 0) - goto error; - break; - case VIR_STORAGE_NET_PROTOCOL_RBD: - /* old-style CEPH_ARGS env variable is parsed later */ - if (!ceph_args && qemuParseRBDString(disk) < 0) - goto error; - break; - case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG: - /* disk->src must be [vdiname] or [host]:[port]:[vdina= me] */ - port =3D strchr(disk->src->path, ':'); - if (port) { - char *vdi; - - *port++ =3D '\0'; - vdi =3D strchr(port, ':'); - if (!vdi) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse sheepdog filena= me '%s'"), val); - goto error; - } - *vdi++ =3D '\0'; - if (VIR_ALLOC(disk->src->hosts) < 0) - goto error; - disk->src->nhosts =3D 1; - disk->src->hosts->name =3D disk->src->path; - if (virStringParsePort(port, &disk->src->hosts->po= rt) < 0) - goto error; - if (VIR_STRDUP(disk->src->path, vdi) < 0) - goto error; - } - break; - case VIR_STORAGE_NET_PROTOCOL_GLUSTER: - if (qemuParseGlusterString(disk) < 0) - goto error; - - break; - case VIR_STORAGE_NET_PROTOCOL_ISCSI: - if (qemuParseISCSIString(disk) < 0) - goto error; - - break; - case VIR_STORAGE_NET_PROTOCOL_VXHS: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("VxHS protocol does not support URI " - "syntax '%s'"), disk->src->path); - goto error; - break; - case VIR_STORAGE_NET_PROTOCOL_HTTP: - case VIR_STORAGE_NET_PROTOCOL_HTTPS: - case VIR_STORAGE_NET_PROTOCOL_FTP: - case VIR_STORAGE_NET_PROTOCOL_FTPS: - case VIR_STORAGE_NET_PROTOCOL_TFTP: - case VIR_STORAGE_NET_PROTOCOL_SSH: - case VIR_STORAGE_NET_PROTOCOL_LAST: - case VIR_STORAGE_NET_PROTOCOL_NONE: - /* ignored for now */ - break; - } - } - - if (virDomainDiskDefAssignAddress(xmlopt, disk, def) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot assign address for device name '%= s'"), - disk->dst); - goto error; - } - - if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0) - goto error; - } else if (STREQ(arg, "-no-acpi")) { - def->features[VIR_DOMAIN_FEATURE_ACPI] =3D VIR_TRISTATE_SWITCH= _ABSENT; - } else if (STREQ(arg, "-no-reboot")) { - def->onReboot =3D VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY; - } else if (STREQ(arg, "-no-kvm")) { - def->virtType =3D VIR_DOMAIN_VIRT_QEMU; - } else if (STREQ(arg, "-enable-kvm")) { - def->virtType =3D VIR_DOMAIN_VIRT_KVM; - } else if (STREQ(arg, "-nographic")) { - nographics =3D true; - } else if (STREQ(arg, "-display")) { - WANT_VALUE(); - if (STREQ(val, "none")) - nographics =3D true; - } else if (STREQ(arg, "-full-screen")) { - fullscreen =3D true; - } else if (STREQ(arg, "-localtime")) { - def->clock.offset =3D VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME; - } else if (STREQ(arg, "-kernel")) { - WANT_VALUE(); - if (VIR_STRDUP(def->os.kernel, val) < 0) - goto error; - } else if (STREQ(arg, "-bios")) { - WANT_VALUE(); - if (VIR_ALLOC(def->os.loader) < 0 || - VIR_STRDUP(def->os.loader->path, val) < 0) - goto error; - } else if (STREQ(arg, "-initrd")) { - WANT_VALUE(); - if (VIR_STRDUP(def->os.initrd, val) < 0) - goto error; - } else if (STREQ(arg, "-append")) { - WANT_VALUE(); - if (VIR_STRDUP(def->os.cmdline, val) < 0) - goto error; - } else if (STREQ(arg, "-dtb")) { - WANT_VALUE(); - if (VIR_STRDUP(def->os.dtb, val) < 0) - goto error; - } else if (STREQ(arg, "-boot")) { - const char *token =3D NULL; - WANT_VALUE(); - - if (!strchr(val, ',')) { - qemuParseCommandLineBootDevs(def, val); - } else { - token =3D val; - while (token && *token) { - if (STRPREFIX(token, "order=3D")) { - token +=3D strlen("order=3D"); - qemuParseCommandLineBootDevs(def, token); - } else if (STRPREFIX(token, "menu=3Don")) { - def->os.bootmenu =3D 1; - } else if (STRPREFIX(token, "reboot-timeout=3D")) { - int num; - char *endptr; - if (virStrToLong_i(token + strlen("reboot-timeout= =3D"), - &endptr, 10, &num) < 0 || - (*endptr !=3D '\0' && endptr !=3D strchr(token= , ','))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot parse reboot-timeout = value")); - goto error; - } - if (num > 65535) - num =3D 65535; - else if (num < -1) - num =3D -1; - def->os.bios.rt_delay =3D num; - def->os.bios.rt_set =3D true; - } - token =3D strchr(token, ','); - /* This incrementation has to be done here in order to= make it - * possible to pass the token pointer properly into th= e loop */ - if (token) - token++; - } - } - } else if (STREQ(arg, "-name")) { - char *process; - WANT_VALUE(); - process =3D strstr(val, ",process=3D"); - if (process =3D=3D NULL) { - if (VIR_STRDUP(def->name, val) < 0) - goto error; - } else { - if (VIR_STRNDUP(def->name, val, process - val) < 0) - goto error; - } - if (STREQ(def->name, "")) - VIR_FREE(def->name); - } else if (STREQ(arg, "-serial")) { - WANT_VALUE(); - if (STRNEQ(val, "none")) { - virDomainChrDefPtr chr; - - if (!(chr =3D virDomainChrDefNew(NULL))) - goto error; - - if (qemuParseCommandLineChr(chr->source, val) < 0) { - virDomainChrDefFree(chr); - goto error; - } - chr->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; - chr->target.port =3D def->nserials; - if (VIR_APPEND_ELEMENT(def->serials, def->nserials, chr) <= 0) { - virDomainChrDefFree(chr); - goto error; - } - } - } else if (STREQ(arg, "-parallel")) { - WANT_VALUE(); - if (STRNEQ(val, "none")) { - virDomainChrDefPtr chr; - - if (!(chr =3D virDomainChrDefNew(NULL))) - goto error; - - if (qemuParseCommandLineChr(chr->source, val) < 0) { - virDomainChrDefFree(chr); - goto error; - } - chr->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL; - chr->target.port =3D def->nparallels; - if (VIR_APPEND_ELEMENT(def->parallels, def->nparallels, ch= r) < 0) { - virDomainChrDefFree(chr); - goto error; - } - } - } else if (STREQ(arg, "-usbdevice")) { - WANT_VALUE(); - if (STREQ(val, "tablet") || - STREQ(val, "mouse") || - STREQ(val, "keyboard")) { - virDomainInputDefPtr input; - if (VIR_ALLOC(input) < 0) - goto error; - input->bus =3D VIR_DOMAIN_INPUT_BUS_USB; - if (STREQ(val, "tablet")) - input->type =3D VIR_DOMAIN_INPUT_TYPE_TABLET; - else if (STREQ(val, "mouse")) - input->type =3D VIR_DOMAIN_INPUT_TYPE_MOUSE; - else - input->type =3D VIR_DOMAIN_INPUT_TYPE_KBD; - - if (VIR_APPEND_ELEMENT(def->inputs, def->ninputs, input) <= 0) { - virDomainInputDefFree(input); - goto error; - } - } else if (STRPREFIX(val, "disk:")) { - if (!(disk =3D virDomainDiskDefNew(xmlopt))) - goto error; - if (VIR_STRDUP(disk->src->path, val + strlen("disk:")) < 0) - goto error; - if (STRPREFIX(disk->src->path, "/dev/")) - disk->src->type =3D VIR_STORAGE_TYPE_BLOCK; - else - disk->src->type =3D VIR_STORAGE_TYPE_FILE; - disk->device =3D VIR_DOMAIN_DISK_DEVICE_DISK; - disk->bus =3D VIR_DOMAIN_DISK_BUS_USB; - disk->removable =3D VIR_TRISTATE_SWITCH_ABSENT; - if (VIR_STRDUP(disk->dst, "sda") < 0) - goto error; - if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0) - goto error; - } else { - virDomainHostdevDefPtr hostdev; - if (!(hostdev =3D qemuParseCommandLineUSB(val))) - goto error; - if (VIR_APPEND_ELEMENT(def->hostdevs, def->nhostdevs, host= dev) < 0) { - virDomainHostdevDefFree(hostdev); - goto error; - } - } - } else if (STREQ(arg, "-net")) { - WANT_VALUE(); - if (!STRPREFIX(val, "nic") && STRNEQ(val, "none")) { - virDomainNetDefPtr net; - if (!(net =3D qemuParseCommandLineNet(xmlopt, val, nnics, = nics))) - goto error; - if (VIR_APPEND_ELEMENT(def->nets, def->nnets, net) < 0) { - virDomainNetDefFree(net); - goto error; - } - } - } else if (STREQ(arg, "-drive")) { - WANT_VALUE(); - if (!(disk =3D qemuParseCommandLineDisk(xmlopt, val, def, - nvirtiodisk, - ceph_args !=3D NULL))) - goto error; - if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO) - nvirtiodisk++; - if (VIR_APPEND_ELEMENT(def->disks, def->ndisks, disk) < 0) - goto error; - } else if (STREQ(arg, "-pcidevice")) { - virDomainHostdevDefPtr hostdev; - WANT_VALUE(); - if (!(hostdev =3D qemuParseCommandLinePCI(val))) - goto error; - if (VIR_APPEND_ELEMENT(def->hostdevs, def->nhostdevs, hostdev)= < 0) { - virDomainHostdevDefFree(hostdev); - goto error; - } - } else if (STREQ(arg, "-soundhw")) { - const char *start; - WANT_VALUE(); - start =3D val; - while (start) { - const char *tmp =3D strchr(start, ','); - int type =3D -1; - if (STRPREFIX(start, "pcspk")) { - type =3D VIR_DOMAIN_SOUND_MODEL_PCSPK; - } else if (STRPREFIX(start, "sb16")) { - type =3D VIR_DOMAIN_SOUND_MODEL_SB16; - } else if (STRPREFIX(start, "es1370")) { - type =3D VIR_DOMAIN_SOUND_MODEL_ES1370; - } else if (STRPREFIX(start, "ac97")) { - type =3D VIR_DOMAIN_SOUND_MODEL_AC97; - } else if (STRPREFIX(start, "hda")) { - type =3D VIR_DOMAIN_SOUND_MODEL_ICH6; - } - - if (type !=3D -1) { - virDomainSoundDefPtr snd; - if (VIR_ALLOC(snd) < 0) - goto error; - snd->model =3D type; - if (VIR_APPEND_ELEMENT(def->sounds, def->nsounds, snd)= < 0) { - VIR_FREE(snd); - goto error; - } - } - - start =3D tmp ? tmp + 1 : NULL; - } - } else if (STREQ(arg, "-watchdog")) { - WANT_VALUE(); - int model =3D virDomainWatchdogModelTypeFromString(val); - - if (model !=3D -1) { - virDomainWatchdogDefPtr wd; - if (VIR_ALLOC(wd) < 0) - goto error; - wd->model =3D model; - wd->action =3D VIR_DOMAIN_WATCHDOG_ACTION_RESET; - def->watchdog =3D wd; - } - } else if (STREQ(arg, "-watchdog-action") && def->watchdog) { - WANT_VALUE(); - int action =3D virDomainWatchdogActionTypeFromString(val); - - if (action !=3D -1) - def->watchdog->action =3D action; - } else if (STREQ(arg, "-bootloader")) { - WANT_VALUE(); - if (VIR_STRDUP(def->os.bootloader, val) < 0) - goto error; - } else if (STREQ(arg, "-vmwarevga")) { - video =3D VIR_DOMAIN_VIDEO_TYPE_VMVGA; - } else if (STREQ(arg, "-std-vga")) { - video =3D VIR_DOMAIN_VIDEO_TYPE_VGA; - } else if (STREQ(arg, "-vga")) { - WANT_VALUE(); - if (STRNEQ(val, "none")) { - video =3D qemuVideoTypeFromString(val); - if (video < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown video adapter type '%s'"), v= al); - goto error; - } - } - } else if (STREQ(arg, "-cpu")) { - WANT_VALUE(); - if (qemuParseCommandLineCPU(def, val) < 0) - goto error; - } else if (STREQ(arg, "-domid")) { - WANT_VALUE(); - /* ignore, generted on the fly */ - } else if (STREQ(arg, "-usb")) { - if (virDomainDefAddUSBController(def, -1, -1) < 0) - goto error; - } else if (STREQ(arg, "-pidfile")) { - WANT_VALUE(); - if (pidfile) - if (VIR_STRDUP(*pidfile, val) < 0) - goto error; - } else if (STREQ(arg, "-incoming")) { - WANT_VALUE(); - /* ignore, used via restore/migrate APIs */ - } else if (STREQ(arg, "-monitor")) { - WANT_VALUE(); - if (monConfig) { - virDomainChrSourceDefPtr chr; - - if (!(chr =3D virDomainChrSourceDefNew(NULL))) - goto error; - - if (qemuParseCommandLineChr(chr, val) < 0) { - virObjectUnref(chr); - goto error; - } - - *monConfig =3D chr; - } - } else if (STREQ(arg, "-global") && - STRPREFIX(progargv[i + 1], "PIIX4_PM.disable_s3=3D")) { - /* We want to parse only the known "-global" parameters, - * so the ones that we don't know are still added to the - * namespace */ - WANT_VALUE(); - - val +=3D strlen("PIIX4_PM.disable_s3=3D"); - if (STREQ(val, "0")) { - def->pm.s3 =3D VIR_TRISTATE_BOOL_YES; - } else if (STREQ(val, "1")) { - def->pm.s3 =3D VIR_TRISTATE_BOOL_NO; - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid value for disable_s3 parameter: " - "'%s'"), val); - goto error; - } - - } else if (STREQ(arg, "-global") && - STRPREFIX(progargv[i + 1], "PIIX4_PM.disable_s4=3D")) { - - WANT_VALUE(); - - val +=3D strlen("PIIX4_PM.disable_s4=3D"); - if (STREQ(val, "0")) { - def->pm.s4 =3D VIR_TRISTATE_BOOL_YES; - } else if (STREQ(val, "1")) { - def->pm.s4 =3D VIR_TRISTATE_BOOL_NO; - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid value for disable_s4 parameter: " - "'%s'"), val); - goto error; - } - - } else if (STREQ(arg, "-global") && - STRPREFIX(progargv[i + 1], "spapr-nvram.reg=3D")) { - WANT_VALUE(); - - if (VIR_ALLOC(def->nvram) < 0) - goto error; - - def->nvram->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPR= VIO; - def->nvram->info.addr.spaprvio.has_reg =3D true; - - val +=3D strlen("spapr-nvram.reg=3D"); - if (virStrToLong_ull(val, NULL, 16, - &def->nvram->info.addr.spaprvio.reg) < 0)= { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse nvram's address '%s'"), val= ); - goto error; - } - } else if (STREQ(arg, "-S") || - STREQ(arg, "-nodefaults") || - STREQ(arg, "-nodefconfig")) { - /* ignore, always added by libvirt */ - } else if (STREQ(arg, "-device") && progargv[1 + 1]) { - const char *opts =3D progargv[i + 1]; - - /* NB: we can't do WANT_VALUE until we're sure that we - * recognize the device, otherwise the !argRecognized - * logic below will be messed up - */ - - if (STRPREFIX(opts, "virtio-balloon")) { - WANT_VALUE(); - if (VIR_ALLOC(def->memballoon) < 0) - goto error; - def->memballoon->model =3D VIR_DOMAIN_MEMBALLOON_MODEL_VIR= TIO; - } else { - /* add in new -device's here */ - - argRecognized =3D false; - } - } else if (STREQ(arg, "-M") || - STREQ(arg, "-machine")) { - /* This option has already been processed before entering this - * loop, so we just need to skip its argument and move along */ - WANT_VALUE(); - } else { - argRecognized =3D false; - } - - if (!argRecognized) { - char *tmp =3D NULL; - /* something we can't yet parse. Add it to the qemu namespace - * cmdline/environment advanced options and hope for the best - */ - VIR_WARN("unknown QEMU argument '%s', adding to the qemu names= pace", - arg); - if (VIR_STRDUP(tmp, arg) < 0 || - VIR_APPEND_ELEMENT(cmd->args, cmd->num_args, tmp) < 0) { - VIR_FREE(tmp); - goto error; - } - } - } - -#undef WANT_VALUE - if (def->ndisks > 0 && ceph_args) { - char *hosts, *port, *saveptr =3D NULL, *token; - virDomainDiskDefPtr first_rbd_disk =3D NULL; - for (i =3D 0; i < def->ndisks; i++) { - if (def->disks[i]->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK && - def->disks[i]->src->protocol =3D=3D VIR_STORAGE_NET_PROTOC= OL_RBD) { - first_rbd_disk =3D def->disks[i]; - break; - } - } - - if (!first_rbd_disk) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("CEPH_ARGS was set without an rbd disk")); - goto error; - } - - /* CEPH_ARGS should be: -m host1[:port1][,host2[:port2]]... */ - if (!STRPREFIX(ceph_args, "-m ")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("could not parse CEPH_ARGS '%s'"), ceph_args); - goto error; - } - if (VIR_STRDUP(hosts, strchr(ceph_args, ' ') + 1) < 0) - goto error; - first_rbd_disk->src->nhosts =3D 0; - token =3D strtok_r(hosts, ",", &saveptr); - while (token !=3D NULL) { - if (VIR_REALLOC_N(first_rbd_disk->src->hosts, - first_rbd_disk->src->nhosts + 1) < 0) { - VIR_FREE(hosts); - goto error; - } - port =3D strchr(token, ':'); - if (port) { - *port++ =3D '\0'; - if (virStringParsePort(port, - &first_rbd_disk->src->hosts[first_r= bd_disk->src->nhosts].port) < 0) { - VIR_FREE(hosts); - goto error; - } - } - if (VIR_STRDUP(first_rbd_disk->src->hosts[first_rbd_disk->src-= >nhosts].name, - token) < 0) { - VIR_FREE(hosts); - goto error; - } - first_rbd_disk->src->hosts[first_rbd_disk->src->nhosts].transp= ort =3D VIR_STORAGE_NET_HOST_TRANS_TCP; - first_rbd_disk->src->hosts[first_rbd_disk->src->nhosts].socket= =3D NULL; - - first_rbd_disk->src->nhosts++; - token =3D strtok_r(NULL, ",", &saveptr); - } - VIR_FREE(hosts); - - if (first_rbd_disk->src->nhosts =3D=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("found no rbd hosts in CEPH_ARGS '%s'"), ceph= _args); - goto error; - } - } - - if (!nographics && (def->ngraphics =3D=3D 0 || have_sdl)) { - virDomainGraphicsDefPtr sdl; - const char *display =3D qemuFindEnv(progenv, "DISPLAY"); - const char *xauth =3D qemuFindEnv(progenv, "XAUTHORITY"); - if (VIR_ALLOC(sdl) < 0) - goto error; - sdl->type =3D VIR_DOMAIN_GRAPHICS_TYPE_SDL; - sdl->data.sdl.fullscreen =3D fullscreen; - if (VIR_STRDUP(sdl->data.sdl.display, display) < 0) { - VIR_FREE(sdl); - goto error; - } - if (VIR_STRDUP(sdl->data.sdl.xauth, xauth) < 0) { - VIR_FREE(sdl); - goto error; - } - - if (VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, sdl) < 0) { - virDomainGraphicsDefFree(sdl); - goto error; - } - } - - if (def->ngraphics) { - virDomainVideoDefPtr vid; - if (!(vid =3D virDomainVideoDefNew())) - goto error; - vid->type =3D video; - - if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) { - virDomainVideoDefFree(vid); - goto error; - } - } - - /* - * having a balloon is the default, define one with type=3D"none" to a= void it - */ - if (!def->memballoon) { - virDomainMemballoonDefPtr memballoon; - if (VIR_ALLOC(memballoon) < 0) - goto error; - memballoon->model =3D VIR_DOMAIN_MEMBALLOON_MODEL_NONE; - - def->memballoon =3D memballoon; - } - - VIR_FREE(nics); - - if (virDomainDefPostParse(def, caps, 0, xmlopt, NULL) < 0) - goto error; - - if (cmd->num_args || cmd->num_env) { - def->ns =3D *virDomainXMLOptionGetNamespace(xmlopt); - def->namespaceData =3D cmd; - } - else - qemuDomainCmdlineDefFree(cmd); - - virObjectUnref(qemuCaps); - return def; - - error: - virDomainDiskDefFree(disk); - qemuDomainCmdlineDefFree(cmd); - virDomainDefFree(def); - virStringListFree(list); - VIR_FREE(nics); - if (monConfig) { - virObjectUnref(*monConfig); - *monConfig =3D NULL; - } - if (pidfile) - VIR_FREE(*pidfile); - virObjectUnref(qemuCaps); - return NULL; -} - - -virDomainDefPtr qemuParseCommandLineString(virFileCachePtr capsCache, - virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - const char *args, - char **pidfile, - virDomainChrSourceDefPtr *monCo= nfig, - bool *monJSON) -{ - char **progenv =3D NULL; - char **progargv =3D NULL; - virDomainDefPtr def =3D NULL; - - if (qemuStringToArgvEnv(args, &progenv, &progargv) < 0) - goto cleanup; - - def =3D qemuParseCommandLine(capsCache, caps, xmlopt, progenv, progarg= v, - pidfile, monConfig, monJSON); - - cleanup: - virStringListFree(progargv); - virStringListFree(progenv); - - return def; -} diff --git a/src/qemu/qemu_parse_command.h b/src/qemu/qemu_parse_command.h index 4dbb08fd59..4af2665eb8 100644 --- a/src/qemu/qemu_parse_command.h +++ b/src/qemu/qemu_parse_command.h @@ -22,22 +22,8 @@ #ifndef LIBVIRT_QEMU_PARSE_COMMAND_H # define LIBVIRT_QEMU_PARSE_COMMAND_H -# include "virfilecache.h" - # define QEMU_QXL_VGAMEM_DEFAULT 16 * 1024 -/* - * NB: def->name can be NULL upon return and the caller - * *must* decide how to fill in a name in this case - */ -virDomainDefPtr qemuParseCommandLineString(virFileCachePtr capsCache, - virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - const char *args, - char **pidfile, - virDomainChrSourceDefPtr *monCo= nfig, - bool *monJSON); - void qemuParseKeywordsFree(int nkeywords, char **keywords, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560777439; cv=none; d=zoho.com; s=zohoarc; b=OehJhKacKP1PmFpo3WfTe02NRfhPK/x4TNQgvhisqychGFqSRFY6ynAJLs5x/661rRFq7mvtgcf/XSgruvPLYzijl4aaAbx/n8SFdG6mJncvuVZ0qFcf+ZwzGthCmks9+C8k25iW6FSyiziOaBkEd9tDR5gK5YGL04Pqx4m6Xbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560777439; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=qr6G5zNNF527LPgN6GHxLmQj/l04AUChwOoYa50s5L4=; b=fu+bjcZbib17S9pofb244hIi9cuPSQvUXUt8p0onmJ3520q7mHqehCgkeRlGJoko7i12+969XLO3ME6lvr8pUjeeQBAbMO3vl0+GT3Fkr5BYu0UjkFJmgk2rVludrN5BrRWI/hrFXtVKs8iYi1aqwZPsLX8/ITM0T+4wqx37zQI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156077743997623.332715379916976; Mon, 17 Jun 2019 06:17:19 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92B752F8BF1; Mon, 17 Jun 2019 13:17:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6603A8CB92; Mon, 17 Jun 2019 13:17:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1BB1A206D8; Mon, 17 Jun 2019 13:17:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCtkcd024626 for ; Mon, 17 Jun 2019 08:55:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 300CC3781; Mon, 17 Jun 2019 12:55:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF16A179E8 for ; Mon, 17 Jun 2019 12:55:45 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 8/9] qemu: Move QEMU_QXL_VGAMEM_DEFAULT macro X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Jun 2019 13:17:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" qemu_domain.c is now the only place that uses it, so we can move it from qemu_parse_command.h Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 3 ++- src/qemu/qemu_parse_command.h | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e5c6ef3fda..8262107311 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -27,7 +27,6 @@ #include "qemu_cgroup.h" #include "qemu_command.h" #include "qemu_process.h" -#include "qemu_parse_command.h" #include "qemu_capabilities.h" #include "qemu_migration.h" #include "qemu_migration_params.h" @@ -74,6 +73,8 @@ #include #include "dosname.h" +#define QEMU_QXL_VGAMEM_DEFAULT 16 * 1024 + #define VIR_FROM_THIS VIR_FROM_QEMU VIR_LOG_INIT("qemu.qemu_domain"); diff --git a/src/qemu/qemu_parse_command.h b/src/qemu/qemu_parse_command.h index 4af2665eb8..e7af48e95b 100644 --- a/src/qemu/qemu_parse_command.h +++ b/src/qemu/qemu_parse_command.h @@ -22,8 +22,6 @@ #ifndef LIBVIRT_QEMU_PARSE_COMMAND_H # define LIBVIRT_QEMU_PARSE_COMMAND_H -# define QEMU_QXL_VGAMEM_DEFAULT 16 * 1024 - void qemuParseKeywordsFree(int nkeywords, char **keywords, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 03:27:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560776241; cv=none; d=zoho.com; s=zohoarc; b=lqJqbMICaMjMC5mu7INtKiVpgFFp1YUDPsZVSg24Vn/wdDsda53dOiGcwiDGlWRge6nkpvvW+tnRG51hh55pzkkkqkD5ZPdBenHaw6Y7a0OGa66KZe+t40THqH8BBqyTWvYXApixlxo9g0uCxqTHe1wa2seSIGjaynSIxB24UDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560776241; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=n+QYXmsteD2xsepVBROeE1BrGxgYQ736VxIQIkIRELs=; b=L3EHHa35r6X70bvRoYSE3Zn5LNtMt6NO3ZEa0LVhe5gTHgKmS6+uetyuqGf3RWjdvp9lgAKSTRtBwyQPKdUnu8dPHDcciutUbZ8Av5YEAo5AaIZs++CjF9nh9x/ocVjXZAG+1CdJ/hjDGy6AozGtwCrnb9WQkh7XUoJZEmRMtXw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560776241363803.7921246471145; Mon, 17 Jun 2019 05:57:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F01CB30BC585; Mon, 17 Jun 2019 12:57:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB5B81FE; Mon, 17 Jun 2019 12:57:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 912C61806B16; Mon, 17 Jun 2019 12:56:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5HCtkxr024639 for ; Mon, 17 Jun 2019 08:55:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFA7568B2F; Mon, 17 Jun 2019 12:55:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AA1817C67 for ; Mon, 17 Jun 2019 12:55:46 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 17 Jun 2019 14:55:34 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 9/9] qemu: Move qemuParseKeywords(Free) to the monitor code X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 17 Jun 2019 12:57:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The only user is now in qemu_monitor_json.c to re-parse the command line format into keyvalue pairs for use in QMP command construction. Move and rename the functions. Signed-off-by: Peter Krempa Reviewed-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- po/POTFILES | 1 - src/qemu/Makefile.inc.am | 2 - src/qemu/qemu_monitor_json.c | 124 +++++++++++++++++++++++++++- src/qemu/qemu_parse_command.c | 149 ---------------------------------- src/qemu/qemu_parse_command.h | 37 --------- 5 files changed, 120 insertions(+), 193 deletions(-) delete mode 100644 src/qemu/qemu_parse_command.c delete mode 100644 src/qemu/qemu_parse_command.h diff --git a/po/POTFILES b/po/POTFILES index 9dd4ee7d99..ccfc873a89 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -140,7 +140,6 @@ src/qemu/qemu_migration_params.c src/qemu/qemu_monitor.c src/qemu/qemu_monitor_json.c src/qemu/qemu_monitor_text.c -src/qemu/qemu_parse_command.c src/qemu/qemu_process.c src/qemu/qemu_qapi.c src/remote/remote_client_bodies.h diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am index fd32a90d56..254ba07dc0 100644 --- a/src/qemu/Makefile.inc.am +++ b/src/qemu/Makefile.inc.am @@ -13,8 +13,6 @@ QEMU_DRIVER_SOURCES =3D \ qemu/qemu_capabilities.h \ qemu/qemu_command.c \ qemu/qemu_command.h \ - qemu/qemu_parse_command.c \ - qemu/qemu_parse_command.h \ qemu/qemu_domain.c \ qemu/qemu_domain.h \ qemu/qemu_domain_address.c \ diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2dcd65d86f..2ec41a77e2 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -31,7 +31,6 @@ #include "qemu_monitor_text.h" #include "qemu_monitor_json.h" #include "qemu_alias.h" -#include "qemu_parse_command.h" #include "qemu_capabilities.h" #include "viralloc.h" #include "virlog.h" @@ -555,6 +554,123 @@ qemuMonitorJSONMakeCommand(const char *cmdname, } +static void +qemuMonitorJSONParseKeywordsFree(int nkeywords, + char **keywords, + char **values) +{ + size_t i; + for (i =3D 0; i < nkeywords; i++) { + VIR_FREE(keywords[i]); + VIR_FREE(values[i]); + } + VIR_FREE(keywords); + VIR_FREE(values); +} + + +/* + * Takes a string containing a set of key=3Dvalue,key=3Dvalue,key... + * parameters and splits them up, returning two arrays with + * the individual keys and values. If allowEmptyValue is nonzero, + * the "=3Dvalue" part is optional and if a key with no value is found, + * NULL is be placed into corresponding place in retvalues. + */ +static int +qemuMonitorJSONParseKeywords(const char *str, + char ***retkeywords, + char ***retvalues, + int *retnkeywords, + int allowEmptyValue) +{ + int keywordCount =3D 0; + int keywordAlloc =3D 0; + char **keywords =3D NULL; + char **values =3D NULL; + const char *start =3D str; + const char *end; + + *retkeywords =3D NULL; + *retvalues =3D NULL; + *retnkeywords =3D 0; + end =3D start + strlen(str); + + while (start) { + const char *separator; + const char *endmark; + char *keyword; + char *value =3D NULL; + + endmark =3D start; + do { + /* QEMU accepts ',,' as an escape for a literal comma; + * skip past those here while searching for the end of the + * value, then strip them down below */ + endmark =3D strchr(endmark, ','); + } while (endmark && endmark[1] =3D=3D ',' && (endmark +=3D 2)); + if (!endmark) + endmark =3D end; + if (!(separator =3D strchr(start, '=3D'))) + separator =3D end; + + if (separator >=3D endmark) { + if (!allowEmptyValue) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("malformed keyword arguments in '%s'"), s= tr); + goto error; + } + separator =3D endmark; + } + + if (VIR_STRNDUP(keyword, start, separator - start) < 0) + goto error; + + if (separator < endmark) { + separator++; + if (VIR_STRNDUP(value, separator, endmark - separator) < 0) { + VIR_FREE(keyword); + goto error; + } + if (strchr(value, ',')) { + char *p =3D strchr(value, ',') + 1; + char *q =3D p + 1; + while (*q) { + if (*q =3D=3D ',') + q++; + *p++ =3D *q++; + } + *p =3D '\0'; + } + } + + if (keywordAlloc =3D=3D keywordCount) { + if (VIR_REALLOC_N(keywords, keywordAlloc + 10) < 0 || + VIR_REALLOC_N(values, keywordAlloc + 10) < 0) { + VIR_FREE(keyword); + VIR_FREE(value); + goto error; + } + keywordAlloc +=3D 10; + } + + keywords[keywordCount] =3D keyword; + values[keywordCount] =3D value; + keywordCount++; + + start =3D endmark < end ? endmark + 1 : NULL; + } + + *retkeywords =3D keywords; + *retvalues =3D values; + *retnkeywords =3D keywordCount; + return 0; + + error: + qemuMonitorJSONParseKeywordsFree(keywordCount, keywords, values); + return -1; +} + + static virJSONValuePtr qemuMonitorJSONKeywordStringToJSON(const char *str, const char *firstkeywo= rd) { @@ -567,7 +683,7 @@ qemuMonitorJSONKeywordStringToJSON(const char *str, con= st char *firstkeyword) if (!(ret =3D virJSONValueNewObject())) return NULL; - if (qemuParseKeywords(str, &keywords, &values, &nkeywords, 1) < 0) + if (qemuMonitorJSONParseKeywords(str, &keywords, &values, &nkeywords, = 1) < 0) goto error; for (i =3D 0; i < nkeywords; i++) { @@ -588,11 +704,11 @@ qemuMonitorJSONKeywordStringToJSON(const char *str, c= onst char *firstkeyword) } } - qemuParseKeywordsFree(nkeywords, keywords, values); + qemuMonitorJSONParseKeywordsFree(nkeywords, keywords, values); return ret; error: - qemuParseKeywordsFree(nkeywords, keywords, values); + qemuMonitorJSONParseKeywordsFree(nkeywords, keywords, values); virJSONValueFree(ret); return NULL; } diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c deleted file mode 100644 index b49aa92fb3..0000000000 --- a/src/qemu/qemu_parse_command.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * qemu_parse_command.c: QEMU command parser - * - * Copyright (C) 2006-2016 Red Hat, Inc. - * Copyright (C) 2006 Daniel P. Berrange - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * . - */ - -#include - -#include "qemu_parse_command.h" -#include "viralloc.h" -#include "virlog.h" -#include "virstring.h" -#include "virerror.h" - -#define VIR_FROM_THIS VIR_FROM_QEMU - -VIR_LOG_INIT("qemu.qemu_parse_command"); - - -void -qemuParseKeywordsFree(int nkeywords, - char **keywords, - char **values) -{ - size_t i; - for (i =3D 0; i < nkeywords; i++) { - VIR_FREE(keywords[i]); - VIR_FREE(values[i]); - } - VIR_FREE(keywords); - VIR_FREE(values); -} - - -/* - * Takes a string containing a set of key=3Dvalue,key=3Dvalue,key... - * parameters and splits them up, returning two arrays with - * the individual keys and values. If allowEmptyValue is nonzero, - * the "=3Dvalue" part is optional and if a key with no value is found, - * NULL is be placed into corresponding place in retvalues. - */ -int -qemuParseKeywords(const char *str, - char ***retkeywords, - char ***retvalues, - int *retnkeywords, - int allowEmptyValue) -{ - int keywordCount =3D 0; - int keywordAlloc =3D 0; - char **keywords =3D NULL; - char **values =3D NULL; - const char *start =3D str; - const char *end; - - *retkeywords =3D NULL; - *retvalues =3D NULL; - *retnkeywords =3D 0; - end =3D start + strlen(str); - - while (start) { - const char *separator; - const char *endmark; - char *keyword; - char *value =3D NULL; - - endmark =3D start; - do { - /* QEMU accepts ',,' as an escape for a literal comma; - * skip past those here while searching for the end of the - * value, then strip them down below */ - endmark =3D strchr(endmark, ','); - } while (endmark && endmark[1] =3D=3D ',' && (endmark +=3D 2)); - if (!endmark) - endmark =3D end; - if (!(separator =3D strchr(start, '=3D'))) - separator =3D end; - - if (separator >=3D endmark) { - if (!allowEmptyValue) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("malformed keyword arguments in '%s'"), s= tr); - goto error; - } - separator =3D endmark; - } - - if (VIR_STRNDUP(keyword, start, separator - start) < 0) - goto error; - - if (separator < endmark) { - separator++; - if (VIR_STRNDUP(value, separator, endmark - separator) < 0) { - VIR_FREE(keyword); - goto error; - } - if (strchr(value, ',')) { - char *p =3D strchr(value, ',') + 1; - char *q =3D p + 1; - while (*q) { - if (*q =3D=3D ',') - q++; - *p++ =3D *q++; - } - *p =3D '\0'; - } - } - - if (keywordAlloc =3D=3D keywordCount) { - if (VIR_REALLOC_N(keywords, keywordAlloc + 10) < 0 || - VIR_REALLOC_N(values, keywordAlloc + 10) < 0) { - VIR_FREE(keyword); - VIR_FREE(value); - goto error; - } - keywordAlloc +=3D 10; - } - - keywords[keywordCount] =3D keyword; - values[keywordCount] =3D value; - keywordCount++; - - start =3D endmark < end ? endmark + 1 : NULL; - } - - *retkeywords =3D keywords; - *retvalues =3D values; - *retnkeywords =3D keywordCount; - return 0; - - error: - qemuParseKeywordsFree(keywordCount, keywords, values); - return -1; -} diff --git a/src/qemu/qemu_parse_command.h b/src/qemu/qemu_parse_command.h deleted file mode 100644 index e7af48e95b..0000000000 --- a/src/qemu/qemu_parse_command.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * qemu_parse_command.h: QEMU command parser - * - * Copyright (C) 2006-2016 Red Hat, Inc. - * Copyright (C) 2006 Daniel P. Berrange - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * . - */ - -#ifndef LIBVIRT_QEMU_PARSE_COMMAND_H -# define LIBVIRT_QEMU_PARSE_COMMAND_H - -void -qemuParseKeywordsFree(int nkeywords, - char **keywords, - char **values); - -int -qemuParseKeywords(const char *str, - char ***retkeywords, - char ***retvalues, - int *retnkeywords, - int allowEmptyValue); - -#endif /* LIBVIRT_QEMU_PARSE_COMMAND_H */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list