mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-09-19 01:44:56 +03:00
Compare commits
12 Commits
v1.2.20
...
v1.2.12-ma
Author | SHA1 | Date | |
---|---|---|---|
|
819c14190c | ||
|
b5ddfbc0fe | ||
|
56fe8df69f | ||
|
039372edd9 | ||
|
32eb2a5897 | ||
|
bd1a133fc8 | ||
|
34538870c7 | ||
|
c518518bd0 | ||
|
5e7b535238 | ||
|
0e1054a129 | ||
|
1021df2815 | ||
|
b89978d53d |
@@ -1609,11 +1609,10 @@ remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (doms && ndomains > 0) {
|
||||
if (doms && ndomains > 0)
|
||||
for (i = 0; i < ndomains; i++)
|
||||
virObjectUnref(doms[i]);
|
||||
VIR_FREE(doms);
|
||||
}
|
||||
VIR_FREE(doms);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -4533,11 +4532,10 @@ remoteDispatchDomainListAllSnapshots(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
virObjectUnref(dom);
|
||||
if (snaps && nsnaps > 0) {
|
||||
if (snaps && nsnaps > 0)
|
||||
for (i = 0; i < nsnaps; i++)
|
||||
virObjectUnref(snaps[i]);
|
||||
VIR_FREE(snaps);
|
||||
}
|
||||
VIR_FREE(snaps);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -4602,11 +4600,10 @@ remoteDispatchDomainSnapshotListAllChildren(virNetServerPtr server ATTRIBUTE_UNU
|
||||
virNetMessageSaveError(rerr);
|
||||
virObjectUnref(snapshot);
|
||||
virObjectUnref(dom);
|
||||
if (snaps && nsnaps > 0) {
|
||||
if (snaps && nsnaps > 0)
|
||||
for (i = 0; i < nsnaps; i++)
|
||||
virObjectUnref(snaps[i]);
|
||||
VIR_FREE(snaps);
|
||||
}
|
||||
VIR_FREE(snaps);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -4661,11 +4658,10 @@ remoteDispatchConnectListAllStoragePools(virNetServerPtr server ATTRIBUTE_UNUSED
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (pools && npools > 0) {
|
||||
if (pools && npools > 0)
|
||||
for (i = 0; i < npools; i++)
|
||||
virObjectUnref(pools[i]);
|
||||
VIR_FREE(pools);
|
||||
}
|
||||
VIR_FREE(pools);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -4724,11 +4720,10 @@ remoteDispatchStoragePoolListAllVolumes(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (vols && nvols > 0) {
|
||||
if (vols && nvols > 0)
|
||||
for (i = 0; i < nvols; i++)
|
||||
virObjectUnref(vols[i]);
|
||||
VIR_FREE(vols);
|
||||
}
|
||||
VIR_FREE(vols);
|
||||
virObjectUnref(pool);
|
||||
return rv;
|
||||
}
|
||||
@@ -4784,11 +4779,10 @@ remoteDispatchConnectListAllNetworks(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (nets && nnets > 0) {
|
||||
if (nets && nnets > 0)
|
||||
for (i = 0; i < nnets; i++)
|
||||
virObjectUnref(nets[i]);
|
||||
VIR_FREE(nets);
|
||||
}
|
||||
VIR_FREE(nets);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -4843,11 +4837,10 @@ remoteDispatchConnectListAllInterfaces(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (ifaces && nifaces > 0) {
|
||||
if (ifaces && nifaces > 0)
|
||||
for (i = 0; i < nifaces; i++)
|
||||
virObjectUnref(ifaces[i]);
|
||||
VIR_FREE(ifaces);
|
||||
}
|
||||
VIR_FREE(ifaces);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -4902,11 +4895,10 @@ remoteDispatchConnectListAllNodeDevices(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (devices && ndevices > 0) {
|
||||
if (devices && ndevices > 0)
|
||||
for (i = 0; i < ndevices; i++)
|
||||
virObjectUnref(devices[i]);
|
||||
VIR_FREE(devices);
|
||||
}
|
||||
VIR_FREE(devices);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -4961,11 +4953,10 @@ remoteDispatchConnectListAllNWFilters(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (filters && nfilters > 0) {
|
||||
if (filters && nfilters > 0)
|
||||
for (i = 0; i < nfilters; i++)
|
||||
virObjectUnref(filters[i]);
|
||||
VIR_FREE(filters);
|
||||
}
|
||||
VIR_FREE(filters);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -5020,11 +5011,10 @@ remoteDispatchConnectListAllSecrets(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (secrets && nsecrets > 0) {
|
||||
if (secrets && nsecrets > 0)
|
||||
for (i = 0; i < nsecrets; i++)
|
||||
virObjectUnref(secrets[i]);
|
||||
VIR_FREE(secrets);
|
||||
}
|
||||
VIR_FREE(secrets);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -6192,11 +6182,10 @@ remoteDispatchNetworkGetDHCPLeases(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
cleanup:
|
||||
if (rv < 0)
|
||||
virNetMessageSaveError(rerr);
|
||||
if (leases && nleases > 0) {
|
||||
if (leases && nleases > 0)
|
||||
for (i = 0; i < nleases; i++)
|
||||
virNetworkDHCPLeaseFree(leases[i]);
|
||||
VIR_FREE(leases);
|
||||
}
|
||||
VIR_FREE(leases);
|
||||
virObjectUnref(net);
|
||||
return rv;
|
||||
}
|
||||
|
@@ -158,6 +158,7 @@ virCPUDefCopy(const virCPUDef *cpu)
|
||||
|
||||
for (i = 0; i < cpu->ncells; i++) {
|
||||
copy->cells[i].mem = cpu->cells[i].mem;
|
||||
copy->cells[i].memAccess = cpu->cells[i].memAccess;
|
||||
|
||||
copy->cells[i].cpumask = virBitmapNewCopy(cpu->cells[i].cpumask);
|
||||
|
||||
|
@@ -845,7 +845,7 @@ typedef struct {
|
||||
|
||||
static const virLXCBasicMountInfo lxcBasicMounts[] = {
|
||||
{ "proc", "/proc", "proc", MS_NOSUID|MS_NOEXEC|MS_NODEV, false, false, false },
|
||||
{ "/proc/sys", "/proc/sys", NULL, MS_BIND|MS_RDONLY, false, false, false },
|
||||
{ "/proc/sys", "/proc/sys", NULL, MS_BIND|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false, false },
|
||||
{ "/.oldroot/proc/sys/net/ipv4", "/proc/sys/net/ipv4", NULL, MS_BIND, false, false, true },
|
||||
{ "/.oldroot/proc/sys/net/ipv6", "/proc/sys/net/ipv6", NULL, MS_BIND, false, false, true },
|
||||
{ "sysfs", "/sys", "sysfs", MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false, false, false },
|
||||
@@ -1025,7 +1025,7 @@ static int lxcContainerMountBasicFS(bool userns_enabled,
|
||||
|
||||
if (bindOverReadonly &&
|
||||
mount(mnt_src, mnt->dst, NULL,
|
||||
MS_BIND|MS_REMOUNT|MS_RDONLY, NULL) < 0) {
|
||||
MS_BIND|MS_REMOUNT|mnt_mflags|MS_RDONLY, NULL) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to re-mount %s on %s flags=%x"),
|
||||
mnt_src, mnt->dst,
|
||||
|
@@ -598,7 +598,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
info->cpuTime = 0;
|
||||
info->memory = 0;
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
} else {
|
||||
if (virCgroupGetCpuacctUsage(priv->cgroup, &(info->cpuTime)) < 0) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
|
@@ -789,7 +789,7 @@ qemuInitCgroup(virQEMUDriverPtr driver,
|
||||
static void
|
||||
qemuRestoreCgroupState(virDomainObjPtr vm)
|
||||
{
|
||||
char *mem_mask;
|
||||
char *mem_mask = NULL;
|
||||
int empty = -1;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
virBitmapPtr all_nodes;
|
||||
|
@@ -1380,6 +1380,12 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm, virVcpuInfoPtr info, int maxinfo,
|
||||
if ((hostcpus = nodeGetCPUCount()) < 0)
|
||||
return -1;
|
||||
|
||||
if (priv->vcpupids == NULL) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cpu affinity is not supported"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
maxcpu = maplen * 8;
|
||||
if (maxcpu > hostcpus)
|
||||
maxcpu = hostcpus;
|
||||
@@ -1395,8 +1401,7 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm, virVcpuInfoPtr info, int maxinfo,
|
||||
info[i].number = i;
|
||||
info[i].state = VIR_VCPU_RUNNING;
|
||||
|
||||
if (priv->vcpupids != NULL &&
|
||||
qemuGetProcessInfo(&(info[i].cpuTime),
|
||||
if (qemuGetProcessInfo(&(info[i].cpuTime),
|
||||
&(info[i].cpu),
|
||||
NULL,
|
||||
vm->pid,
|
||||
@@ -1410,28 +1415,22 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm, virVcpuInfoPtr info, int maxinfo,
|
||||
|
||||
if (cpumaps != NULL) {
|
||||
memset(cpumaps, 0, maplen * maxinfo);
|
||||
if (priv->vcpupids != NULL) {
|
||||
for (v = 0; v < maxinfo; v++) {
|
||||
unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
|
||||
virBitmapPtr map = NULL;
|
||||
unsigned char *tmpmap = NULL;
|
||||
int tmpmapLen = 0;
|
||||
for (v = 0; v < maxinfo; v++) {
|
||||
unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
|
||||
virBitmapPtr map = NULL;
|
||||
unsigned char *tmpmap = NULL;
|
||||
int tmpmapLen = 0;
|
||||
|
||||
if (virProcessGetAffinity(priv->vcpupids[v],
|
||||
&map, maxcpu) < 0)
|
||||
return -1;
|
||||
virBitmapToData(map, &tmpmap, &tmpmapLen);
|
||||
if (tmpmapLen > maplen)
|
||||
tmpmapLen = maplen;
|
||||
memcpy(cpumap, tmpmap, tmpmapLen);
|
||||
if (virProcessGetAffinity(priv->vcpupids[v],
|
||||
&map, maxcpu) < 0)
|
||||
return -1;
|
||||
virBitmapToData(map, &tmpmap, &tmpmapLen);
|
||||
if (tmpmapLen > maplen)
|
||||
tmpmapLen = maplen;
|
||||
memcpy(cpumap, tmpmap, tmpmapLen);
|
||||
|
||||
VIR_FREE(tmpmap);
|
||||
virBitmapFree(map);
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cpu affinity is not available"));
|
||||
return -1;
|
||||
VIR_FREE(tmpmap);
|
||||
virBitmapFree(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2630,7 +2629,7 @@ static int qemuDomainGetInfo(virDomainPtr dom,
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
}
|
||||
} else {
|
||||
info->memory = 0;
|
||||
info->memory = vm->def->mem.cur_balloon;
|
||||
}
|
||||
|
||||
info->nrVirtCpu = vm->def->vcpus;
|
||||
@@ -4605,13 +4604,13 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_LIVE && !(flags & VIR_DOMAIN_VCPU_GUEST)) {
|
||||
if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
|
||||
goto cleanup;
|
||||
goto endjob;
|
||||
|
||||
if (!(all_nodes = virNumaGetHostNodeset()))
|
||||
goto cleanup;
|
||||
goto endjob;
|
||||
|
||||
if (!(all_nodes_str = virBitmapFormat(all_nodes)))
|
||||
goto cleanup;
|
||||
goto endjob;
|
||||
|
||||
if (virCgroupGetCpusetMems(cgroup_temp, &mem_mask) < 0 ||
|
||||
virCgroupSetCpusetMems(cgroup_temp, all_nodes_str) < 0)
|
||||
|
@@ -3624,6 +3624,7 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
|
||||
time_t now = time(NULL);
|
||||
char expire_time [64];
|
||||
const char *connected = NULL;
|
||||
const char *password;
|
||||
int ret = -1;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
@@ -3631,16 +3632,14 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
password = auth->passwd ? auth->passwd : defaultPasswd;
|
||||
|
||||
if (auth->connected)
|
||||
connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
goto cleanup;
|
||||
ret = qemuMonitorSetPassword(priv->mon,
|
||||
type,
|
||||
auth->passwd ? auth->passwd : defaultPasswd,
|
||||
connected);
|
||||
ret = qemuMonitorSetPassword(priv->mon, type, password, connected);
|
||||
|
||||
if (ret == -2) {
|
||||
if (type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||
@@ -3648,14 +3647,15 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
|
||||
_("Graphics password only supported for VNC"));
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = qemuMonitorSetVNCPassword(priv->mon,
|
||||
auth->passwd ? auth->passwd : defaultPasswd);
|
||||
ret = qemuMonitorSetVNCPassword(priv->mon, password);
|
||||
}
|
||||
}
|
||||
if (ret != 0)
|
||||
goto end_job;
|
||||
|
||||
if (auth->expires) {
|
||||
if (password[0] == '\0') {
|
||||
snprintf(expire_time, sizeof(expire_time), "now");
|
||||
} else if (auth->expires) {
|
||||
time_t lifetime = auth->validTo - now;
|
||||
if (lifetime <= 0)
|
||||
snprintf(expire_time, sizeof(expire_time), "now");
|
||||
|
@@ -2498,9 +2498,18 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
|
||||
return 0;
|
||||
|
||||
if (priv->vcpupids == NULL) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cpu affinity is not supported"));
|
||||
return -1;
|
||||
/* If any CPU has custom affinity that differs from the
|
||||
* VM default affinity, we must reject it
|
||||
*/
|
||||
for (n = 0; n < def->vcpus; n++) {
|
||||
if (!virBitmapEqual(def->cpumask,
|
||||
def->cputune.vcpupin[n]->cpumask)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cpu affinity is not supported"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (n = 0; n < def->vcpus; n++) {
|
||||
|
@@ -540,10 +540,6 @@ remoteClientCloseFunc(virNetClientPtr client ATTRIBUTE_UNUSED,
|
||||
cbdata->freeCallback = NULL;
|
||||
}
|
||||
virObjectUnlock(cbdata);
|
||||
|
||||
/* free the connection reference that comes along with the callback
|
||||
* registration */
|
||||
virObjectUnref(cbdata->conn);
|
||||
}
|
||||
|
||||
/* helper macro to ease extraction of arguments from the URI */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* storage_backend_fs.c: storage backend for FS and directory handling
|
||||
*
|
||||
* Copyright (C) 2007-2014 Red Hat, Inc.
|
||||
* Copyright (C) 2007-2015 Red Hat, Inc.
|
||||
* Copyright (C) 2007-2008 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -1003,6 +1003,14 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
||||
vol->type = VIR_STORAGE_VOL_FILE;
|
||||
|
||||
/* Volumes within a directory pools are not recursive; do not
|
||||
* allow escape to ../ or a subdir */
|
||||
if (strchr(vol->name, '/')) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("volume name '%s' cannot contain '/'"), vol->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
VIR_FREE(vol->target.path);
|
||||
if (virAsprintf(&vol->target.path, "%s/%s",
|
||||
pool->def->target.path,
|
||||
|
@@ -504,6 +504,12 @@ bool virBitmapEqual(virBitmapPtr b1, virBitmapPtr b2)
|
||||
virBitmapPtr tmp;
|
||||
size_t i;
|
||||
|
||||
if (!b1 && !b2)
|
||||
return true;
|
||||
|
||||
if (!b1 || !b2)
|
||||
return false;
|
||||
|
||||
if (b1->max_bit > b2->max_bit) {
|
||||
tmp = b1;
|
||||
b1 = b2;
|
||||
|
@@ -84,8 +84,7 @@ virBitmapPtr virBitmapNewData(void *data, int len) ATTRIBUTE_NONNULL(1);
|
||||
int virBitmapToData(virBitmapPtr bitmap, unsigned char **data, int *dataLen)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
||||
bool virBitmapEqual(virBitmapPtr b1, virBitmapPtr b2)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
bool virBitmapEqual(virBitmapPtr b1, virBitmapPtr b2);
|
||||
|
||||
size_t virBitmapSize(virBitmapPtr bitmap)
|
||||
ATTRIBUTE_NONNULL(1);
|
||||
|
Reference in New Issue
Block a user