[libvirt] Use of 'detach' flag with QMP command `migrate` in qemuMonitorJSONMigrate()
by Kashyap Chamarthy
The qmp-commands.hx file from QEMU says[1]:
"The user Monitor's "detach" argument is invalid in QMP and should
not be used"
However, when live block migration is performed, I still see that
libvirt sets the 'detach' boolean to 'true':
[. . .]
2015-04-09 11:20:54.160+0000: 12152: debug : qemuMonitorJSONCommandWithFd:290 : Send command '{"execute":"migrate","arguments":{"detach":true,"blk":true,"inc":false,"uri":"fd:migrate"},"id":"libvirt-18"}' for write with FD -1
[. . .]
Where 'detach' means: "not wait for completion" (reading hmp-commands.hx
in QEMU source) or 'QEMU_MONITOR_MIGRATE_BACKGROUND' (reading
qemuMonitorJSONMigrate() from qemu_monitor_json.c in libvirt source).
Two questions:
- Should the 'detach' flag be not passed in this case, because the
documentation says it's not valid in QMP case?
- _What_ exactly is setting the 'detach' flag explicitly in this case?
Or is it default when using 'inc' flag ('--copy-storage-inc' in
`virsh` parlance)?
Contextual libvirtd.log from source, with log_filter for 'qemu' set[2].
Note that in the above case, live block migration _did_ succeed, I'm
just asking this to educate myself.
PS: If you're wondering why am I not using the new 'drive-mirror' based
approach above, I performed this block migration via OpenStack Nova.
Currently in Nova's case, live block migration falls back to the old
approach of QMP `migrate` command (with 'inc' flag set to true -- it
explicitly set by OpenStack Nova) via qemuMonitorJsonMigrate(), and
not the new way of qemuMonitorJSONDriveMirror().
I was testing with:
- libvirt-daemon-driver-qemu-1.2.13.1-2.fc22.x86_64
- qemu-system-x86-2.3.1-1.fc22.x86_64
[1] http://git.qemu.org/?p=qemu.git;a=blob;f=qmp-commands.hx#l643
[2] https://kashyapc.fedorapeople.org/virt/temp/live-blk-migration-libvirt-de...
--
/kashyap
9 years, 1 month
[libvirt] [libvirt-test-API] [PATCH] change some cases order in conf file linux_domain.conf
by Shanzhi Yu
Some cases need guest agent running in domain, change some cases order
to avoid the failure.
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
cases/linux_domain.conf | 100 ++++++++++++++++++++++++------------------------
1 file changed, 50 insertions(+), 50 deletions(-)
diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index 5b216f9..6315613 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -78,6 +78,56 @@ domain:get_guest_network_info
flags
agent
+domain:domain_fsfreeze
+ guestname
+ $defaultname
+
+domain:domain_fsthaw
+ guestname
+ $defaultname
+
+domain:domain_fsfreeze
+ guestname
+ $defaultname
+ mountpoint
+ /
+
+domain:domain_fsthaw
+ guestname
+ $defaultname
+
+domain:fsinfo
+ guestname
+ $defaultname
+ username
+ $username
+ userpassword
+ $password
+ conn
+ qemu:///system
+
+domain:set_user_passwd
+ guestname
+ $defaultname
+ username
+ $username
+ userpassword
+ $password
+ conn
+ qemu:///system
+
+domain:set_user_passwd
+ guestname
+ $defaultname
+ username
+ $username
+ userpassword
+ $password
+ conn
+ qemu:///system
+ flags
+ encrypted
+
virconn:connection_getAllDomainStats
stats
state|cpu|balloon|vcpu|interface|block
@@ -259,24 +309,6 @@ domain:open_graphicsfd
flags
skipauth
-domain:domain_fsfreeze
- guestname
- $defaultname
-
-domain:domain_fsthaw
- guestname
- $defaultname
-
-domain:domain_fsfreeze
- guestname
- $defaultname
- mountpoint
- /
-
-domain:domain_fsthaw
- guestname
- $defaultname
-
virconn:connection_security_model
guestname
$defaultname
@@ -311,38 +343,6 @@ domain:info_iothread
conn
qemu:///system
-domain:fsinfo
- guestname
- $defaultname
- username
- $username
- userpassword
- $password
- conn
- qemu:///system
-
-domain:set_user_passwd
- guestname
- $defaultname
- username
- $username
- userpassword
- $password
- conn
- qemu:///system
-
-domain:set_user_passwd
- guestname
- $defaultname
- username
- $username
- userpassword
- $password
- conn
- qemu:///system
- flags
- encrypted
-
domain:destroy
guestname
$defaultname
--
1.8.3.1
9 years, 1 month
[libvirt] [PATCH] Remove unused variables.
by Martin Kletzander
I was playing with coccinelle tool the other day and just for the fun of
it, I tried removing some useless things from our code. And look what
came up. No functional change, and we're down in the number of lines by
about a hundred.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
daemon/remote.c | 5 +---
src/bhyve/bhyve_driver.c | 38 +++++++++++--------------------
src/conf/storage_conf.c | 9 +++-----
src/libxl/libxl_driver.c | 36 ++++++++++-------------------
src/lxc/lxc_driver.c | 36 ++++++++++-------------------
src/lxc/lxc_native.c | 5 +---
src/network/bridge_driver.c | 38 +++++++++----------------------
src/nwfilter/nwfilter_ebiptables_driver.c | 21 ++++++++---------
src/qemu/qemu_command.c | 19 ++++++----------
src/qemu/qemu_driver.c | 14 ++++--------
src/qemu/qemu_migration.c | 9 +++-----
src/qemu/qemu_process.c | 18 ++++-----------
src/storage/storage_backend_iscsi.c | 5 +---
src/test/test_driver.c | 30 ++++++++----------------
src/util/virdbus.c | 5 +---
src/util/virfile.c | 4 +---
src/util/virhashcode.c | 4 +---
src/util/virstoragefile.c | 1 -
src/vbox/vbox_storage.c | 8 ++-----
src/vz/vz_network.c | 24 +++++++------------
src/xen/xen_hypervisor.c | 5 +---
src/xen/xend_internal.c | 6 +----
22 files changed, 107 insertions(+), 233 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 3a3eb0913088..289454315aca 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -6703,10 +6703,7 @@ get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool)
static virStorageVolPtr
get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol)
{
- virStorageVolPtr ret;
- ret = virGetStorageVol(conn, vol.pool, vol.name, vol.key,
- NULL, NULL);
- return ret;
+ return virGetStorageVol(conn, vol.pool, vol.name, vol.key, NULL, NULL);
}
static virSecretPtr
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 7f365b1f2446..5e1b9cb0c1ed 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -608,30 +608,24 @@ static int
bhyveConnectListDomains(virConnectPtr conn, int *ids, int maxids)
{
bhyveConnPtr privconn = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(privconn->domains, ids, maxids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(privconn->domains, ids, maxids,
+ virConnectListDomainsCheckACL, conn);
}
static int
bhyveConnectNumOfDomains(virConnectPtr conn)
{
bhyveConnPtr privconn = conn->privateData;
- int count;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- count = virDomainObjListNumOfDomains(privconn->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return count;
+ return virDomainObjListNumOfDomains(privconn->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
static int
@@ -639,31 +633,28 @@ bhyveConnectListDefinedDomains(virConnectPtr conn, char **const names,
int maxnames)
{
bhyveConnPtr privconn = conn->privateData;
- int n;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
memset(names, 0, sizeof(*names) * maxnames);
- n = virDomainObjListGetInactiveNames(privconn->domains, names,
- maxnames, virConnectListDefinedDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetInactiveNames(privconn->domains, names,
+ maxnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int
bhyveConnectNumOfDefinedDomains(virConnectPtr conn)
{
bhyveConnPtr privconn = conn->privateData;
- int count;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- count = virDomainObjListNumOfDomains(privconn->domains, false,
- virConnectNumOfDefinedDomainsCheckACL, conn);
-
- return count;
+ return virDomainObjListNumOfDomains(privconn->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
static char *
@@ -730,17 +721,14 @@ bhyveConnectListAllDomains(virConnectPtr conn,
unsigned int flags)
{
bhyveConnPtr privconn = conn->privateData;
- int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
if (virConnectListAllDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListExport(privconn->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
-
- return ret;
+ return virDomainObjListExport(privconn->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
static virDomainPtr
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 9dae1a39bb5b..b17f38399d22 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1995,14 +1995,11 @@ static int virStoragePoolSaveXML(const char *path,
const char *xml)
{
char uuidstr[VIR_UUID_STRING_BUFLEN];
- int ret = -1;
virUUIDFormat(def->uuid, uuidstr);
- ret = virXMLSaveFile(path,
- virXMLPickShellSafeComment(def->name, uuidstr),
- "pool-edit", xml);
-
- return ret;
+ return virXMLSaveFile(path,
+ virXMLPickShellSafeComment(def->name, uuidstr),
+ "pool-edit", xml);
}
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 504895754170..c941e8ef065e 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -922,30 +922,24 @@ static int
libxlConnectListDomains(virConnectPtr conn, int *ids, int nids)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
+ virConnectListDomainsCheckACL, conn);
}
static int
libxlConnectNumOfDomains(virConnectPtr conn)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
static virDomainPtr
@@ -2677,29 +2671,26 @@ libxlConnectListDefinedDomains(virConnectPtr conn,
char **const names, int nnames)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
- virConnectListDefinedDomainsCheckACL, conn);
- return n;
+ return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int
libxlConnectNumOfDefinedDomains(virConnectPtr conn)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int n;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, false,
- virConnectNumOfDefinedDomainsCheckACL,
- conn);
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
static int
@@ -4689,17 +4680,14 @@ libxlConnectListAllDomains(virConnectPtr conn,
unsigned int flags)
{
libxlDriverPrivatePtr driver = conn->privateData;
- int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
if (virConnectListAllDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListExport(driver->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
-
- return ret;
+ return virDomainObjListExport(driver->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
/* Which features are supported by this driver? */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index a9f0005f55b3..30ebd8c25e21 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -387,59 +387,49 @@ static int lxcDomainIsUpdated(virDomainPtr dom)
static int lxcConnectListDomains(virConnectPtr conn, int *ids, int nids)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
+ virConnectListDomainsCheckACL, conn);
}
static int lxcConnectNumOfDomains(virConnectPtr conn)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
static int lxcConnectListDefinedDomains(virConnectPtr conn,
char **const names, int nnames)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
- virConnectListDefinedDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
+ virConnectListDefinedDomainsCheckACL,
+ conn);
}
static int lxcConnectNumOfDefinedDomains(virConnectPtr conn)
{
virLXCDriverPtr driver = conn->privateData;
- int n;
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, false,
- virConnectNumOfDefinedDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, false,
+ virConnectNumOfDefinedDomainsCheckACL,
+ conn);
}
@@ -3596,16 +3586,14 @@ lxcConnectListAllDomains(virConnectPtr conn,
unsigned int flags)
{
virLXCDriverPtr driver = conn->privateData;
- int ret = -1;
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
if (virConnectListAllDomainsEnsureACL(conn) < 0)
return -1;
- ret = virDomainObjListExport(driver->domains, conn, domains,
- virConnectListAllDomainsCheckACL, flags);
- return ret;
+ return virDomainObjListExport(driver->domains, conn, domains,
+ virConnectListAllDomainsCheckACL, flags);
}
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 2f9559735a46..39e5261c6583 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -646,7 +646,6 @@ static int
lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
{
int status;
- int result = -1;
size_t i;
lxcNetworkParseData data = {def, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, 0,
@@ -670,9 +669,7 @@ lxcConvertNetworkSettings(virDomainDefPtr def, virConfPtr properties)
/* When no network type is provided LXC only adds loopback */
def->features[VIR_DOMAIN_FEATURE_PRIVNET] = VIR_TRISTATE_SWITCH_ON;
}
- result = 0;
-
- return result;
+ return 0;
error:
for (i = 0; i < data.nips; i++)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index c343e5bdd2dd..34decaba0a78 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2604,17 +2604,13 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn,
static int networkConnectNumOfNetworks(virConnectPtr conn)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int nactive;
if (virConnectNumOfNetworksEnsureACL(conn) < 0)
return -1;
- nactive = virNetworkObjListNumOfNetworks(driver->networks,
- true,
- virConnectNumOfNetworksCheckACL,
- conn);
-
- return nactive;
+ return virNetworkObjListNumOfNetworks(driver->networks, true,
+ virConnectNumOfNetworksCheckACL,
+ conn);
}
static int networkConnectListNetworks(virConnectPtr conn,
@@ -2622,48 +2618,36 @@ static int networkConnectListNetworks(virConnectPtr conn,
int nnames)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int got = 0;
if (virConnectListNetworksEnsureACL(conn) < 0)
return -1;
- got = virNetworkObjListGetNames(driver->networks,
- true, names, nnames,
- virConnectListNetworksCheckACL,
- conn);
-
- return got;
+ return virNetworkObjListGetNames(driver->networks, true, names, nnames,
+ virConnectListNetworksCheckACL, conn);
}
static int networkConnectNumOfDefinedNetworks(virConnectPtr conn)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int ninactive = 0;
if (virConnectNumOfDefinedNetworksEnsureACL(conn) < 0)
return -1;
- ninactive = virNetworkObjListNumOfNetworks(driver->networks,
- false,
- virConnectNumOfDefinedNetworksCheckACL,
- conn);
-
- return ninactive;
+ return virNetworkObjListNumOfNetworks(driver->networks, false,
+ virConnectNumOfDefinedNetworksCheckACL,
+ conn);
}
static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames)
{
virNetworkDriverStatePtr driver = networkGetDriver();
- int got = 0;
if (virConnectListDefinedNetworksEnsureACL(conn) < 0)
return -1;
- got = virNetworkObjListGetNames(driver->networks,
- false, names, nnames,
- virConnectListDefinedNetworksCheckACL,
- conn);
- return got;
+ return virNetworkObjListGetNames(driver->networks, false, names, nnames,
+ virConnectListDefinedNetworksCheckACL,
+ conn);
}
static int
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 423d069e1b26..04783576b661 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -1770,18 +1770,17 @@ iptablesCreateRuleInstance(virFirewallPtr fw,
chainPrefix[0] = 'H';
chainPrefix[1] = CHAINPREFIX_HOST_IN_TEMP;
- rc = _iptablesCreateRuleInstance(fw,
- layer,
- directionIn,
- chainPrefix,
- rule,
- ifname,
- vars,
- matchState, true,
- "RETURN",
- maySkipICMP);
- return rc;
+ return _iptablesCreateRuleInstance(fw,
+ layer,
+ directionIn,
+ chainPrefix,
+ rule,
+ ifname,
+ vars,
+ matchState, true,
+ "RETURN",
+ maySkipICMP);
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bb1835c2f5f1..9c96531a0ce7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6349,14 +6349,11 @@ qemuBuildSCSIHostHostdevDrvStr(virDomainHostdevDefPtr dev,
{
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
- char *sg = NULL;
- sg = (callbacks->qemuGetSCSIDeviceSgName)(NULL,
- scsihostsrc->adapter,
- scsihostsrc->bus,
- scsihostsrc->target,
- scsihostsrc->unit);
- return sg;
+ return (callbacks->qemuGetSCSIDeviceSgName)(NULL, scsihostsrc->adapter,
+ scsihostsrc->bus,
+ scsihostsrc->target,
+ scsihostsrc->unit);
}
static char *
@@ -8961,17 +8958,15 @@ char *
qemuBuildShmemBackendStr(virDomainShmemDefPtr shmem,
virQEMUCapsPtr qemuCaps)
{
- char *devstr = NULL;
-
if (!shmem->server.chr.data.nix.path &&
virAsprintf(&shmem->server.chr.data.nix.path,
"/var/lib/libvirt/shmem-%s-sock",
shmem->name) < 0)
return NULL;
- devstr = qemuBuildChrChardevStr(&shmem->server.chr, shmem->info.alias, qemuCaps);
-
- return devstr;
+ return qemuBuildChrChardevStr(&shmem->server.chr,
+ shmem->info.alias,
+ qemuCaps);
}
static int
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2387cf3f9699..ab6b5cb2ee76 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1646,29 +1646,23 @@ static char *qemuConnectGetHostname(virConnectPtr conn)
static int qemuConnectListDomains(virConnectPtr conn, int *ids, int nids)
{
virQEMUDriverPtr driver = conn->privateData;
- int n;
if (virConnectListDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListGetActiveIDs(driver->domains, ids, nids,
- virConnectListDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
+ virConnectListDomainsCheckACL, conn);
}
static int qemuConnectNumOfDomains(virConnectPtr conn)
{
virQEMUDriverPtr driver = conn->privateData;
- int n;
if (virConnectNumOfDomainsEnsureACL(conn) < 0)
return -1;
- n = virDomainObjListNumOfDomains(driver->domains, true,
- virConnectNumOfDomainsCheckACL, conn);
-
- return n;
+ return virDomainObjListNumOfDomains(driver->domains, true,
+ virConnectNumOfDomainsCheckACL, conn);
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3dd3718d0974..ea2f8d35ec6e 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3520,8 +3520,6 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
const char *origname,
unsigned long flags)
{
- int ret;
-
VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
"cookieout=%p, cookieoutlen=%p, st=%p, def=%p, "
"origname=%s, flags=%lx",
@@ -3534,10 +3532,9 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
return -1;
}
- ret = qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
- cookieout, cookieoutlen, def, origname,
- st, NULL, 0, false, NULL, 0, NULL, flags);
- return ret;
+ return qemuMigrationPrepareAny(driver, dconn, cookiein, cookieinlen,
+ cookieout, cookieoutlen, def, origname, st,
+ NULL, 0, false, NULL, 0, NULL, flags);
}
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b961f400af1c..5e32d3cabe31 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2498,7 +2498,6 @@ qemuProcessSetEmulatorAffinity(virDomainObjPtr vm)
{
virBitmapPtr cpumask;
virDomainDefPtr def = vm->def;
- int ret = -1;
if (def->cputune.emulatorpin)
cpumask = def->cputune.emulatorpin;
@@ -2507,8 +2506,7 @@ qemuProcessSetEmulatorAffinity(virDomainObjPtr vm)
else
return 0;
- ret = virProcessSetAffinity(vm->pid, cpumask);
- return ret;
+ return virProcessSetAffinity(vm->pid, cpumask);
}
/* Set CPU affinities for IOThreads threads. */
@@ -5113,8 +5111,6 @@ int qemuProcessStart(virConnectPtr conn,
int
qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
{
- int ret;
-
VIR_DEBUG("vm=%p name=%s pid=%llu flags=%x",
vm, vm->def->name,
(unsigned long long)vm->pid, flags);
@@ -5133,10 +5129,8 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
return 0;
}
- ret = virProcessKillPainfully(vm->pid,
- !!(flags & VIR_QEMU_PROCESS_KILL_FORCE));
-
- return ret;
+ return virProcessKillPainfully(vm->pid,
+ !!(flags & VIR_QEMU_PROCESS_KILL_FORCE));
}
@@ -5772,11 +5766,9 @@ int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver,
int qemuProcessAutoDestroyRemove(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
- int ret;
VIR_DEBUG("vm=%s", vm->def->name);
- ret = virCloseCallbacksUnset(driver->closeCallbacks, vm,
- qemuProcessAutoDestroy);
- return ret;
+ return virCloseCallbacksUnset(driver->closeCallbacks, vm,
+ qemuProcessAutoDestroy);
}
bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver,
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 9e2d01e457fb..ba1cff2d87c0 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -241,7 +241,6 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool,
bool *isActive)
{
char *session = NULL;
- int ret = -1;
*isActive = false;
@@ -268,9 +267,7 @@ virStorageBackendISCSICheckPool(virStoragePoolObjPtr pool,
*isActive = true;
VIR_FREE(session);
}
- ret = 0;
-
- return ret;
+ return 0;
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index d11cda1f7212..db5090bc1026 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1517,13 +1517,9 @@ testConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
unsigned int ncpus,
unsigned int flags)
{
- char *cpu;
-
virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, NULL);
- cpu = cpuBaselineXML(xmlCPUs, ncpus, NULL, 0, flags);
-
- return cpu;
+ return cpuBaselineXML(xmlCPUs, ncpus, NULL, 0, flags);
}
static int testNodeGetInfo(virConnectPtr conn,
@@ -3110,39 +3106,31 @@ static virNetworkPtr testNetworkLookupByName(virConnectPtr conn,
static int testConnectNumOfNetworks(virConnectPtr conn)
{
testDriverPtr privconn = conn->privateData;
- int numActive;
- numActive = virNetworkObjListNumOfNetworks(privconn->networks,
- true, NULL, conn);
- return numActive;
+ return virNetworkObjListNumOfNetworks(privconn->networks, true, NULL,
+ conn);
}
static int testConnectListNetworks(virConnectPtr conn, char **const names, int nnames) {
testDriverPtr privconn = conn->privateData;
- int n;
- n = virNetworkObjListGetNames(privconn->networks,
- true, names, nnames, NULL, conn);
- return n;
+ return virNetworkObjListGetNames(privconn->networks, true, names, nnames,
+ NULL, conn);
}
static int testConnectNumOfDefinedNetworks(virConnectPtr conn)
{
testDriverPtr privconn = conn->privateData;
- int numInactive;
- numInactive = virNetworkObjListNumOfNetworks(privconn->networks,
- false, NULL, conn);
- return numInactive;
+ return virNetworkObjListNumOfNetworks(privconn->networks, false, NULL,
+ conn);
}
static int testConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) {
testDriverPtr privconn = conn->privateData;
- int n;
- n = virNetworkObjListGetNames(privconn->networks,
- false, names, nnames, NULL, conn);
- return n;
+ return virNetworkObjListGetNames(privconn->networks, false, names, nnames,
+ NULL, conn);
}
static int
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index 78fb7953dca2..41c7e3f95bb1 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -1179,15 +1179,12 @@ virDBusMessageEncodeArgs(DBusMessage* msg,
va_list args)
{
DBusMessageIter iter;
- int ret = -1;
memset(&iter, 0, sizeof(iter));
dbus_message_iter_init_append(msg, &iter);
- ret = virDBusMessageIterEncode(&iter, types, args);
-
- return ret;
+ return virDBusMessageIterEncode(&iter, types, args);
}
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 2332589d0c4b..147215379c29 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -688,9 +688,7 @@ static int virFileLoopDeviceOpen(char **dev_name)
# endif /* HAVE_DECL_LOOP_CTL_GET_FREE */
/* Without the loop control device we just use the old technique. */
- loop_fd = virFileLoopDeviceOpenSearch(dev_name);
-
- return loop_fd;
+ return virFileLoopDeviceOpenSearch(dev_name);
}
int virFileLoopDeviceAssociate(const char *file,
diff --git a/src/util/virhashcode.c b/src/util/virhashcode.c
index 357c05fe246a..10633a99feb3 100644
--- a/src/util/virhashcode.c
+++ b/src/util/virhashcode.c
@@ -115,7 +115,5 @@ uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed)
/* finalization */
h1 ^= len;
- h1 = fmix(h1);
-
- return h1;
+ return fmix(h1);
}
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 2aa1d90d6581..36fca68bccc3 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1104,7 +1104,6 @@ virStorageFileResize(const char *path,
{
int fd = -1;
int ret = -1;
- int rc ATTRIBUTE_UNUSED;
off_t offset ATTRIBUTE_UNUSED;
off_t len ATTRIBUTE_UNUSED;
diff --git a/src/vbox/vbox_storage.c b/src/vbox/vbox_storage.c
index 4367009f04f6..92a5a4a5691f 100644
--- a/src/vbox/vbox_storage.c
+++ b/src/vbox/vbox_storage.c
@@ -119,9 +119,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
- ret = hardDiskAccessible;
-
- return ret;
+ return hardDiskAccessible;
}
static int
@@ -175,9 +173,7 @@ vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, int nname
}
gVBoxAPI.UArray.vboxArrayRelease(&hardDisks);
- ret = numActive;
-
- return ret;
+ return numActive;
}
static virStorageVolPtr
diff --git a/src/vz/vz_network.c b/src/vz/vz_network.c
index 8c978124eddb..083d9b204659 100644
--- a/src/vz/vz_network.c
+++ b/src/vz/vz_network.c
@@ -364,12 +364,10 @@ int vzNetworkClose(virConnectPtr conn)
static int vzConnectNumOfNetworks(virConnectPtr conn)
{
- int nactive;
vzConnPtr privconn = conn->privateData;
- nactive = virNetworkObjListNumOfNetworks(privconn->networks,
- true, NULL, conn);
- return nactive;
+ return virNetworkObjListNumOfNetworks(privconn->networks, true, NULL,
+ conn);
}
static int vzConnectListNetworks(virConnectPtr conn,
@@ -377,21 +375,17 @@ static int vzConnectListNetworks(virConnectPtr conn,
int nnames)
{
vzConnPtr privconn = conn->privateData;
- int got;
- got = virNetworkObjListGetNames(privconn->networks,
- true, names, nnames, NULL, conn);
- return got;
+ return virNetworkObjListGetNames(privconn->networks, true, names, nnames,
+ NULL, conn);
}
static int vzConnectNumOfDefinedNetworks(virConnectPtr conn)
{
- int ninactive;
vzConnPtr privconn = conn->privateData;
- ninactive = virNetworkObjListNumOfNetworks(privconn->networks,
- false, NULL, conn);
- return ninactive;
+ return virNetworkObjListNumOfNetworks(privconn->networks, false, NULL,
+ conn);
}
static int vzConnectListDefinedNetworks(virConnectPtr conn,
@@ -399,11 +393,9 @@ static int vzConnectListDefinedNetworks(virConnectPtr conn,
int nnames)
{
vzConnPtr privconn = conn->privateData;
- int got;
- got = virNetworkObjListGetNames(privconn->networks,
- false, names, nnames, NULL, conn);
- return got;
+ return virNetworkObjListGetNames(privconn->networks, false, names, nnames,
+ NULL, conn);
}
static int vzConnectListAllNetworks(virConnectPtr conn,
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 431c47abdf17..61e58e470e53 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2285,7 +2285,6 @@ xenHypervisorMakeCapabilitiesSunOS(virConnectPtr conn)
{
struct guest_arch guest_arches[32];
size_t i = 0;
- virCapsPtr caps = NULL;
int pae, longmode;
const char *hvm;
@@ -2326,12 +2325,10 @@ xenHypervisorMakeCapabilitiesSunOS(virConnectPtr conn)
}
}
- caps = xenHypervisorBuildCapabilities(conn,
+ return xenHypervisorBuildCapabilities(conn,
virArchFromHost(),
pae, hvm,
guest_arches, i);
-
- return caps;
}
#endif /* __sun */
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index b81c0b743644..b8c31380636f 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -809,11 +809,7 @@ xenDaemonListDomainsOld(virConnectPtr xend)
int
xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr)
{
- int ret;
-
- ret = xend_op(xend, "", "op", "create", "config", sexpr, NULL);
-
- return ret;
+ return xend_op(xend, "", "op", "create", "config", sexpr, NULL);
}
--
2.5.3
9 years, 2 months
[libvirt] [PATCH] virsh: Preserve startupPolicy in change-media command
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1250331
Even after my rework of startupPolicy handling, one command
slipped my attention. The change-media command has a very unique
approach to constructing disk XML. However, it will not preserve
startupPolicy attribute.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/virsh-domain.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index fb138d5..456e273 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11534,6 +11534,7 @@ virshUpdateDiskXML(xmlNodePtr disk_node,
xmlNodePtr source = NULL;
char *device_type = NULL;
char *ret = NULL;
+ char *startupPolicy = NULL;
if (!disk_node)
return NULL;
@@ -11567,13 +11568,15 @@ virshUpdateDiskXML(xmlNodePtr disk_node,
goto cleanup;
}
- if (type == VIRSH_UPDATE_DISK_XML_INSERT && source) {
- vshError(NULL, _("The disk device '%s' already has media"), target);
- goto cleanup;
- }
-
- /* remove current source */
if (source) {
+ if (type == VIRSH_UPDATE_DISK_XML_INSERT) {
+ vshError(NULL, _("The disk device '%s' already has media"), target);
+ goto cleanup;
+ }
+
+ startupPolicy = virXMLPropString(source, "startupPolicy");
+
+ /* remove current source */
xmlUnlinkNode(source);
xmlFreeNode(source);
source = NULL;
@@ -11597,6 +11600,8 @@ virshUpdateDiskXML(xmlNodePtr disk_node,
else
xmlNewProp(source, BAD_CAST "file", BAD_CAST new_source);
+ if (startupPolicy)
+ xmlNewProp(source, BAD_CAST "startupPolicy", BAD_CAST startupPolicy);
xmlAddChild(disk_node, source);
}
@@ -11607,6 +11612,7 @@ virshUpdateDiskXML(xmlNodePtr disk_node,
cleanup:
VIR_FREE(device_type);
+ VIR_FREE(startupPolicy);
return ret;
}
--
2.4.9
9 years, 2 months
[libvirt] [PATCH 0/3] Introduce new virtType enum item
by Shivangi Dhir
These patches solve a BiteSizedTask - Introduce new virtType enum item[0]
[0] http://wiki.libvirt.org/page/BiteSizedTasks#Introduce_new_virtType_enum_item
Shivangi Dhir (3):
conf: Add new VIR_DOMAIN_VIRT_NONE enum
qemu: Make virtType of type virDomainVirtType
conf: Change the description of virCapabilitiesDomainDataLookup()
src/conf/capabilities.c | 6 +++---
src/conf/domain_conf.c | 3 ++-
src/conf/domain_conf.h | 3 ++-
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor.h | 2 +-
src/qemu/qemu_monitor_json.c | 2 +-
src/qemu/qemu_monitor_json.h | 2 +-
src/qemu/qemu_monitor_text.c | 2 +-
src/qemu/qemu_monitor_text.h | 2 +-
tests/qemumonitorjsontest.c | 2 +-
tests/vircapstest.c | 32 ++++++++++++++++----------------
11 files changed, 30 insertions(+), 28 deletions(-)
--
1.9.1
9 years, 2 months
[libvirt] [PATCH] Use daemon log facility for journald
by Guido Günther
otherwise messages end up in /var/log/kern.log if journald forwards to
syslog.
Closes: #799633
---
src/util/virlog.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index b45ee91..627f4cb 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -920,6 +920,7 @@ virLogOutputToJournald(virLogSourcePtr source,
journalAddString(&state, "MESSAGE", rawstr);
journalAddInt(&state, "PRIORITY",
virLogPrioritySyslog(priority));
+ journalAddInt(&state, "SYSLOG_FACILITY", LOG_DAEMON);
journalAddString(&state, "LIBVIRT_SOURCE", source->name);
if (filename)
journalAddString(&state, "CODE_FILE", filename);
--
2.1.4
9 years, 2 months
[libvirt] [PATCH 1/3] cpu_map.xml: add cmt feature to x86
by Qiaowei Ren
Some Intel processor families (e.g. the Intel Xeon processor E5 v3
family) introduced CMT (Cache Monitoring Technology) to measure the
usage of cache by applications running on the platform. This patch
add it into x86 part of cpu_map.xml.
Signed-off-by: Qiaowei Ren <qiaowei.ren(a)intel.com>
---
.gnulib | 2 +-
src/cpu/cpu_map.xml | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/.gnulib b/.gnulib
index f39477d..106a386 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit f39477dba778e99392948dd3dd19ec0d46aee932
+Subproject commit 106a3866d01f9dd57ab4f10dbeb0d5a8db73a9f7
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
index b9e95cf..14ccbd8 100644
--- a/src/cpu/cpu_map.xml
+++ b/src/cpu/cpu_map.xml
@@ -317,6 +317,9 @@
<feature name='rtm'>
<cpuid function='0x00000007' ebx='0x00000800'/>
</feature>
+ <feature name='cmt'>
+ <cpuid function='0x00000007' ebx='0x00001000'/>
+ </feature>
<feature name='rdseed'>
<cpuid function='0x00000007' ebx='0x00040000'/>
</feature>
--
1.9.1
9 years, 2 months
Re: [libvirt] [FIRST-PATCH] updated the negation STREQ to STRNEQ
by Lasya Venneti
Dear Sir,
The cfg.mk link isn't working for me sir..
>From what I understand Makefile will have the following:
target: dependency1 dependency2 ...
[TAB] action1
[TAB] action2
Does the syntax-check rule have to be in place of 'actions' in the form of
a shell command, and then raise an error whenever the shell command returns
occurrences of the string !STREQ or !STRNEQ ? Request you to please
elaborate a little.
Sincerely,
Lasya V
On 21 September 2015 at 16:35, Michal Privoznik <mprivozn(a)redhat.com> wrote:
> [You've got the wrong list. This is a libvirt patch and as such it
> should have been sent to the libvir-list(a)redhat.com]
>
> On 19.09.2015 16:59, Lasya wrote:
> > Hi,
> > This is my first patch in QEMU. I have solved a bite-sized bug. I have
> updated the !STREQ with STRNEQ in the following files. Thanks.
> >
> > ---
> > src/bhyve/bhyve_driver.c | 2 +-
> > src/conf/network_conf.c | 4 ++--
> > src/conf/nwfilter_conf.c | 2 +-
> > src/conf/nwfilter_params.c | 2 +-
> > src/conf/storage_conf.c | 2 +-
> > src/lxc/lxc_fuse.c | 4 ++--
> > src/openvz/openvz_driver.c | 2 +-
> > src/qemu/qemu_command.c | 6 +++---
> > src/qemu/qemu_domain.c | 2 +-
> > src/qemu/qemu_hotplug.c | 2 +-
> > src/security/security_manager.c | 2 +-
> > src/security/security_selinux.c | 12 ++++++------
> > src/storage/storage_backend_logical.c | 2 +-
> > src/util/virfile.c | 2 +-
> > src/util/virsystemd.c | 2 +-
> > src/vz/vz_driver.c | 2 +-
> > src/vz/vz_sdk.c | 2 +-
> > src/xen/xend_internal.c | 2 +-
> > src/xenconfig/xen_sxpr.c | 2 +-
> > tests/commandtest.c | 10 +++++-----
> > tests/securityselinuxlabeltest.c | 2 +-
> > tests/virauthconfigtest.c | 2 +-
> > tests/virbitmaptest.c | 12 ++++++------
> > tests/vircgrouptest.c | 2 +-
> > tests/virkeyfiletest.c | 8 ++++----
> > tests/virnetsockettest.c | 2 +-
> > tests/virtypedparamtest.c | 2 +-
> > tests/viruritest.c | 16 ++++++++--------
> > 28 files changed, 56 insertions(+), 56 deletions(-)
>
> Okay, you've got all the occurrences. However, the syntax-check rule is
> missing. You may want to look at cfg.mk for some examples. syntax-check
> is our make target that checks the code if it complies with our coding
> standards. After this patch we want a rule that forbids !STREQ or !STRNEQ.
>
> Otherwise looking very good. Looking forward to v2.
>
> Michal
>
9 years, 2 months
[libvirt] [PATCH] tools: Link libvirt.la to libvirt_shell.a
by Michal Privoznik
So, our mingw build is broken. It's because while libvirt_shell
library is using some of our internal APIs, e.g. virStrndup, it's
not being linked with libvirt.la. Only subsequent users of the
library, like virsh, do link to libvirt.la. In fact, I'm
surprised Linux linker doesn't care, because how can it make a
static library with missing symbols is mystery to me.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tools/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0a00cee..3cf70db 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -143,6 +143,7 @@ libvirt_shell_la_LDFLAGS = \
$(NULL)
libvirt_shell_la_LIBADD = \
$(LIBXML_LIBS) \
+ ../src/libvirt.la \
../gnulib/lib/libgnu.la \
$(NULL)
libvirt_shell_la_SOURCES = vsh.c vsh.h
@@ -220,7 +221,6 @@ virsh_LDFLAGS = \
virsh_LDADD = \
$(STATIC_BINARIES) \
$(PIE_LDFLAGS) \
- ../src/libvirt.la \
../src/libvirt-lxc.la \
../src/libvirt-qemu.la \
libvirt_shell.la \
--
2.4.9
9 years, 2 months