[libvirt] [PATCH 1/3] bhyve: add domain metadata support
by Roman Bogorodskiy
Implement domainSetMetadata and domainGetMetadata driver calls.
---
src/bhyve/bhyve_driver.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 461a070..f268de4 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -793,6 +793,59 @@ bhyveDomainOpenConsole(virDomainPtr dom,
}
static int
+bhyveDomainSetMetadata(virDomainPtr dom,
+ int type,
+ const char *metadata,
+ const char *key,
+ const char *uri,
+ unsigned int flags)
+{
+ bhyveConnPtr privconn = dom->conn->privateData;
+ virDomainObjPtr vm;
+ int ret = -1;
+
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+ if (!(vm = bhyveDomObjFromDomain(dom)))
+ return -1;
+
+ if (virDomainSetMetadataEnsureACL(dom->conn, vm->def, flags) < 0)
+ goto cleanup;
+
+ ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, privconn->caps,
+ privconn->xmlopt, BHYVE_CONFIG_DIR, flags);
+
+ cleanup:
+ virObjectUnlock(vm);
+ return ret;
+}
+
+static char *
+bhyveDomainGetMetadata(virDomainPtr dom,
+ int type,
+ const char *uri,
+ unsigned int flags)
+{
+ bhyveConnPtr privconn = dom->conn->privateData;
+ virDomainObjPtr vm;
+ char *ret = NULL;
+
+ if (!(vm = bhyveDomObjFromDomain(dom)))
+ return NULL;
+
+ if (virDomainGetMetadataEnsureACL(dom->conn, vm->def) < 0)
+ goto cleanup;
+
+ ret = virDomainObjGetMetadata(vm, type, uri, privconn->caps,
+ privconn->xmlopt, flags);
+
+ cleanup:
+ virObjectUnlock(vm);
+ return ret;
+}
+
+static int
bhyveNodeGetCPUStats(virConnectPtr conn,
int cpuNum,
virNodeCPUStatsPtr params,
@@ -1009,6 +1062,8 @@ static virDriver bhyveDriver = {
.domainGetAutostart = bhyveDomainGetAutostart, /* 1.2.4 */
.domainSetAutostart = bhyveDomainSetAutostart, /* 1.2.4 */
.domainOpenConsole = bhyveDomainOpenConsole, /* 1.2.4 */
+ .domainSetMetadata = bhyveDomainSetMetadata, /* 1.2.4 */
+ .domainGetMetadata = bhyveDomainGetMetadata, /* 1.2.4 */
.nodeGetCPUStats = bhyveNodeGetCPUStats, /* 1.2.2 */
.nodeGetMemoryStats = bhyveNodeGetMemoryStats, /* 1.2.2 */
.nodeGetInfo = bhyveNodeGetInfo, /* 1.2.3 */
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] bhyve: fix ATTRIBUTE_NONNULL usage
by Roman Bogorodskiy
Fix incorrect ATTRIBUTE_NONNULL usage introduced in 17b17565
which caused build failure:
bhyve/bhyve_driver.c:127:48: error: expected ')'
bhyveDriverGetCapabilities(bhyveConnPtr driver ATTRIBUTE_NONNULL)
^
bhyve/bhyve_driver.c:127:27: note: to match this '('
bhyveDriverGetCapabilities(bhyveConnPtr driver ATTRIBUTE_NONNULL)
Pushed under the build breaker rule.
---
src/bhyve/bhyve_driver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index a5b349a..e48528f 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -123,8 +123,8 @@ bhyveAutostartDomains(bhyveConnPtr driver)
*
* Returns: a reference to a virCapsPtr instance or NULL
*/
-static virCapsPtr
-bhyveDriverGetCapabilities(bhyveConnPtr driver ATTRIBUTE_NONNULL)
+static virCapsPtr ATTRIBUTE_NONNULL(1)
+bhyveDriverGetCapabilities(bhyveConnPtr driver)
{
return virObjectRef(driver->caps);
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] vmware: set the driver version
by Jean-Baptiste Rouault
Since commit 7457cbe8 the vmware driver version isn't set anymore.
---
src/vmware/vmware_conf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 6aba4f8..5e894a4 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -301,6 +301,7 @@ vmwareExtractVersion(struct vmware_driver *driver)
if (vmwareParseVersionStr(driver->type, outbuf, &version) < 0)
goto cleanup;
+ driver->version = version;
ret = 0;
cleanup:
--
1.8.5.3
10 years, 8 months
[libvirt] [PATCH] Fix leak on OOM in virNWFilterVarValueCreateSimpleCopyValue
by Daniel P. Berrange
If virNWFilterVarValueCreateSimple fails with OOM, then
'val' will be leaked by virNWFilterVarValueCreateSimpleCopyValue
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/conf/nwfilter_params.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 40eccc4..3e85bc1 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -126,10 +126,14 @@ virNWFilterVarValuePtr
virNWFilterVarValueCreateSimpleCopyValue(const char *value)
{
char *val;
+ virNWFilterVarValuePtr ret;
if (VIR_STRDUP(val, value) < 0)
return NULL;
- return virNWFilterVarValueCreateSimple(val);
+ ret = virNWFilterVarValueCreateSimple(val);
+ if (!ret)
+ VIR_FREE(val);
+ return ret;
}
const char *
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] Fix incorrect values in redirdev ABI check error
by Ján Tomko
My commit c9123fb introduced this copy-and-paste error.
---
Pushed as trivial.
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 52bbf87..1be942d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14231,7 +14231,7 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target domain redirected devices count %zu "
"does not match source %zu"),
- dst->nconsoles, src->nconsoles);
+ dst->nredirdevs, src->nredirdevs);
goto error;
}
--
1.8.3.2
10 years, 8 months
Re: [libvirt] [PATCH] -Added autocloseable to connect class (set close() return type to void so to adapt it to the autocloseable interface)
by Claudio Bley
[forwarding my answer back to the list]
Pasquale, please keep the discussion on the list, you should probably
use the "Reply To All" (or whatever GMail calls it) button when
answering.
At Tue, 08 Apr 2014 16:09:31 +0200,
Claudio Bley wrote:
>
> [Remember /not/ to top-post on technical lists.]
>
> At Mon, 7 Apr 2014 20:28:28 +0200,
> Pasquale Dir wrote:
> >
> > Hello,
> > is it ok if I'll send multiple patches for each added function? I'd start
> > with the getCPUStats which is the most complex as it introduces new jna
> > types too.
>
> Yes, that would be a good start. (although I'd probably do it in
> reverse, starting out with the small changes, then tackling the
> complex ones).
>
> > As for Thread.sleep() is it ok to substitute it with a wait(long) ? Or you
> > have any alternative? That wait is needed for the alghoritm to work.
>
> I'm not convinced that this functionality belongs into the library at
> all. Maybe we could add a convenience method doing the computation
> for two given stats and a time period, but I don't feel strongly in
> support of adding this method.
>
> Regards,
> Claudio
10 years, 8 months
[libvirt] [PATCH] LXC: Fix return code evaulation in lxcCheckNetNsSupport()
by Richard Weinberger
Commit b9dd878f (util: make it easier to grab only regular command exit)
changed the call semantics of virCommandRun() and therefore of virRun()
too. But lxcCheckNetNsSupport() was not updated.
As consequence of this lxcCheckNetNsSupport always failed and broke LXC.
Signed-off-by: Richard Weinberger <richard(a)nod.at>
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index b900bc6..de67004 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1475,8 +1475,7 @@ static int lxcCheckNetNsSupport(void)
const char *argv[] = {"ip", "link", "set", "lo", "netns", "-1", NULL};
int ip_rc;
- if (virRun(argv, &ip_rc) < 0 ||
- !(WIFEXITED(ip_rc) && (WEXITSTATUS(ip_rc) != 255)))
+ if (virRun(argv, &ip_rc) < 0 || ip_rc == 255)
return 0;
if (lxcContainerAvailable(LXC_CONTAINER_FEATURE_NET) < 0)
--
1.8.4.2
10 years, 8 months
[libvirt] [PATCH] Use a static initializer for static mutexes
by Daniel P. Berrange
Now that we ditched our custom pthread impl for Win32, we can
use PTHREAD_MUTEX_INITIALIZER for static mutexes. This avoids
the need to use a virOnce one-time global initializer in a
number of places.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/conf/nwfilter_ipaddrmap.c | 7 +------
src/lxc/lxc_controller.c | 8 +-------
src/nwfilter/nwfilter_ebiptables_driver.c | 5 +----
src/nwfilter/nwfilter_learnipaddr.c | 14 ++------------
src/test/test_driver.c | 17 +----------------
src/util/virnetdevmacvlan.c | 15 +--------------
src/util/virnetdevveth.c | 16 +---------------
src/util/virnodesuspend.c | 22 +---------------------
src/util/virrandom.c | 5 +----
src/util/virthread.h | 5 +++++
10 files changed, 15 insertions(+), 99 deletions(-)
diff --git a/src/conf/nwfilter_ipaddrmap.c b/src/conf/nwfilter_ipaddrmap.c
index 9cbad49c..4bb6775 100644
--- a/src/conf/nwfilter_ipaddrmap.c
+++ b/src/conf/nwfilter_ipaddrmap.c
@@ -33,7 +33,7 @@
#define VIR_FROM_THIS VIR_FROM_NWFILTER
-static virMutex ipAddressMapLock;
+static virMutex ipAddressMapLock = VIR_MUTEX_INITIALIZER;
static virNWFilterHashTablePtr ipAddressMap;
@@ -147,11 +147,6 @@ virNWFilterIPAddrMapInit(void)
if (!ipAddressMap)
return -1;
- if (virMutexInit(&ipAddressMapLock) < 0) {
- virNWFilterIPAddrMapShutdown();
- return -1;
- }
-
return 0;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 1d3a74b..c05dfec 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -823,7 +823,7 @@ static int lxcControllerClearCapabilities(void)
}
static bool wantReboot = false;
-static virMutex lock;
+static virMutex lock = VIR_MUTEX_INITIALIZER;
static void virLXCControllerSignalChildIO(virNetServerPtr server,
@@ -1108,9 +1108,6 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
int rc = -1;
size_t i;
- if (virMutexInit(&lock) < 0)
- goto cleanup2;
-
if (virNetServerAddSignalHandler(ctrl->server,
SIGCHLD,
virLXCControllerSignalChildIO,
@@ -1164,9 +1161,6 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl)
rc = wantReboot ? 1 : 0;
cleanup:
- virMutexDestroy(&lock);
- cleanup2:
-
for (i = 0; i < ctrl->nconsoles; i++)
virLXCControllerConsoleClose(&(ctrl->consoles[i]));
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 8dbab18..ce0b7e3 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -211,7 +211,7 @@ static void ebiptablesDriverShutdown(void);
static void ebtablesCleanAll(const char *ifname);
static int ebiptablesAllTeardown(const char *ifname);
-static virMutex execCLIMutex;
+static virMutex execCLIMutex = VIR_MUTEX_INITIALIZER;
struct ushort_map {
unsigned short attr;
@@ -4376,9 +4376,6 @@ ebiptablesDriverInit(bool privileged)
if (!privileged)
return 0;
- if (virMutexInit(&execCLIMutex) < 0)
- return -EINVAL;
-
grep_cmd_path = virFindFileInPath("grep");
/*
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 1ffed78..a6cdc87 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -119,10 +119,10 @@ struct ether_vlan_header
} ATTRIBUTE_PACKED;
-static virMutex pendingLearnReqLock;
+static virMutex pendingLearnReqLock = VIR_MUTEX_INITIALIZER;
static virHashTablePtr pendingLearnReq;
-static virMutex ifaceMapLock;
+static virMutex ifaceMapLock = VIR_MUTEX_INITIALIZER;
static virHashTablePtr ifaceLockMap;
typedef struct _virNWFilterIfaceLock virNWFilterIfaceLock;
@@ -806,22 +806,12 @@ virNWFilterLearnInit(void)
return -1;
}
- if (virMutexInit(&pendingLearnReqLock) < 0) {
- virNWFilterLearnShutdown();
- return -1;
- }
-
ifaceLockMap = virHashCreate(0, virHashValueFree);
if (!ifaceLockMap) {
virNWFilterLearnShutdown();
return -1;
}
- if (virMutexInit(&ifaceMapLock) < 0) {
- virNWFilterLearnShutdown();
- return -1;
- }
-
return 0;
}
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 77e30b2..64f3daa 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -119,7 +119,7 @@ typedef struct _testConn *testConnPtr;
static testConn defaultConn;
static int defaultConnections;
-static virMutex defaultLock;
+static virMutex defaultLock = VIR_MUTEX_INITIALIZER;
#define TEST_MODEL "i686"
#define TEST_MODEL_WORDSIZE 32
@@ -141,15 +141,6 @@ static int testConnectClose(virConnectPtr conn);
static void testObjectEventQueue(testConnPtr driver,
virObjectEventPtr event);
-static int
-testOnceInit(void)
-{
- return virMutexInit(&defaultLock);
-}
-
-VIR_ONCE_GLOBAL_INIT(test)
-
-
static void testDriverLock(testConnPtr driver)
{
virMutexLock(&driver->lock);
@@ -1554,9 +1545,6 @@ static virDrvOpenStatus testConnectOpen(virConnectPtr conn,
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
- if (testInitialize() < 0)
- return VIR_DRV_OPEN_ERROR;
-
if (!conn->uri)
return VIR_DRV_OPEN_DECLINED;
@@ -1596,9 +1584,6 @@ static int testConnectClose(virConnectPtr conn)
{
testConnPtr privconn = conn->privateData;
- if (testInitialize() < 0)
- return -1;
-
if (privconn == &defaultConn) {
virMutexLock(&defaultLock);
if (--defaultConnections) {
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 42313b7..7bbf540 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -73,18 +73,7 @@ VIR_LOG_INIT("util.netdevmacvlan");
# define MACVLAN_NAME_PREFIX "macvlan"
# define MACVLAN_NAME_PATTERN "macvlan%d"
-virMutex virNetDevMacVLanCreateMutex;
-
-static int virNetDevMacVLanCreateMutexOnceInit(void)
-{
- if (virMutexInit(&virNetDevMacVLanCreateMutex) < 0) {
- virReportSystemError(errno, "%s", _("unable to init mutex"));
- return -1;
- }
- return 0;
-}
-
-VIR_ONCE_GLOBAL_INIT(virNetDevMacVLanCreateMutex);
+virMutex virNetDevMacVLanCreateMutex = VIR_MUTEX_INITIALIZER;
/**
* virNetDevMacVLanCreate:
@@ -873,8 +862,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
} else {
create_name:
retries = 5;
- if (virNetDevMacVLanCreateMutexInitialize() < 0)
- return -1;
virMutexLock(&virNetDevMacVLanCreateMutex);
for (c = 0; c < 8192; c++) {
snprintf(ifname, sizeof(ifname), pattern, c);
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index 14febb7..e9d6f9c 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -41,18 +41,7 @@ VIR_LOG_INIT("util.netdevveth");
/* Functions */
-virMutex virNetDevVethCreateMutex;
-
-static int virNetDevVethCreateMutexOnceInit(void)
-{
- if (virMutexInit(&virNetDevVethCreateMutex) < 0) {
- virReportSystemError(errno, "%s", _("unable to init mutex"));
- return -1;
- }
- return 0;
-}
-
-VIR_ONCE_GLOBAL_INIT(virNetDevVethCreateMutex);
+virMutex virNetDevVethCreateMutex = VIR_MUTEX_INITIALIZER;
static int virNetDevVethExists(int devNum)
{
@@ -132,9 +121,6 @@ int virNetDevVethCreate(char** veth1, char** veth2)
* We might race with other containers, but this is reasonably
* unlikely, so don't do too many retries for device creation
*/
- if (virNetDevVethCreateMutexInitialize() < 0)
- return -1;
-
virMutexLock(&virNetDevVethCreateMutex);
#define MAX_VETH_RETRIES 10
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 8088931..08c47aa 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -46,7 +46,7 @@ VIR_LOG_INIT("util.nodesuspend");
static unsigned int nodeSuspendTargetMask;
static bool nodeSuspendTargetMaskInit;
-static virMutex virNodeSuspendMutex;
+static virMutex virNodeSuspendMutex = VIR_MUTEX_INITIALIZER;
static bool aboutToSuspend;
@@ -61,20 +61,6 @@ static void virNodeSuspendUnlock(void)
}
-static int virNodeSuspendOnceInit(void)
-{
- if (virMutexInit(&virNodeSuspendMutex) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Unable to initialize mutex"));
- return -1;
- }
-
- return 0;
-}
-
-VIR_ONCE_GLOBAL_INIT(virNodeSuspend)
-
-
/**
* virNodeSuspendSetNodeWakeup:
* @alarmTime: time in seconds from now, at which the RTC alarm has to be set.
@@ -178,9 +164,6 @@ int nodeSuspendForDuration(unsigned int target,
virCheckFlags(0, -1);
- if (virNodeSuspendInitialize() < 0)
- return -1;
-
if (virNodeSuspendGetTargetMask(&supported) < 0)
return -1;
@@ -267,9 +250,6 @@ virNodeSuspendSupportsTarget(unsigned int target, bool *supported)
int status;
int ret = -1;
- if (virNodeSuspendInitialize() < 0)
- return -1;
-
*supported = false;
switch (target) {
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 3f17f5e..4301f3f 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -56,7 +56,7 @@ enum {
static char randomState[RANDOM_STATE_SIZE];
static struct random_data randomData;
-static virMutex randomLock;
+static virMutex randomLock = VIR_MUTEX_INITIALIZER;
static int
@@ -74,9 +74,6 @@ virRandomOnceInit(void)
return -1;
#endif
- if (virMutexInit(&randomLock) < 0)
- return -1;
-
if (initstate_r(seed,
randomState,
sizeof(randomState),
diff --git a/src/util/virthread.h b/src/util/virthread.h
index eba8dc3..4b92a43 100644
--- a/src/util/virthread.h
+++ b/src/util/virthread.h
@@ -71,6 +71,11 @@ struct virOnceControl {
};
+# define VIR_MUTEX_INITIALIZER \
+ { \
+ .lock = PTHREAD_MUTEX_INITIALIZER \
+ }
+
# define VIR_ONCE_CONTROL_INITIALIZER \
{ \
.once = PTHREAD_ONCE_INIT \
--
1.9.0
10 years, 8 months
[libvirt] [PATCH] virnetdev: Fix Memory Leak in virNetDevReplaceMacAddress() and virNetDevRestoreMacAddress()
by Wangrui (K)
function virNetDevRestoreMacAddress() and virNetDevRestoreMacAddress() alloc memory for
variable 'path' using virAsprintf(), but they havn't free that memory before returning out.
Signed-off-by: Zhang bo <oscar.zhangbo(a)huawei.com>
---
src/util/virnetdev.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index f26ea80..853f6ef 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -310,6 +310,7 @@ virNetDevReplaceMacAddress(const char *linkdev,
virMacAddr oldmac;
char *path = NULL;
char macstr[VIR_MAC_STRING_BUFLEN];
+ int ret = -1;
if (virNetDevGetMAC(linkdev, &oldmac) < 0)
return -1;
@@ -323,13 +324,17 @@ virNetDevReplaceMacAddress(const char *linkdev,
if (virFileWriteStr(path, macstr, O_CREAT|O_TRUNC|O_WRONLY) < 0) {
virReportSystemError(errno, _("Unable to preserve mac for %s"),
linkdev);
- return -1;
+ goto cleanup;
}
if (virNetDevSetMAC(linkdev, macaddress) < 0)
- return -1;
+ goto cleanup;
- return 0;
+ ret = 0;
+
+cleanup:
+ VIR_FREE(path);
+ return ret;
}
/**
@@ -344,7 +349,7 @@ int
virNetDevRestoreMacAddress(const char *linkdev,
const char *stateDir)
{
- int rc;
+ int rc = -1;
char *oldmacname = NULL;
char *macstr = NULL;
char *path = NULL;
@@ -356,21 +361,22 @@ virNetDevRestoreMacAddress(const char *linkdev,
return -1;
if (virFileReadAll(path, VIR_MAC_STRING_BUFLEN, &macstr) < 0)
- return -1;
+ goto cleanup;
if (virMacAddrParse(macstr, &oldmac) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Cannot parse MAC address from '%s'"),
oldmacname);
- VIR_FREE(macstr);
- return -1;
+ goto cleanup;
}
/*reset mac and remove file-ignore results*/
rc = virNetDevSetMAC(linkdev, &oldmac);
ignore_value(unlink(path));
- VIR_FREE(macstr);
+cleanup:
+ VIR_FREE(macstr);
+ VIR_FREE(path);
return rc;
}
--
1.8.3.4
10 years, 8 months
[libvirt] [PATCH v1 0/2] Keep original file label
by Michal Privoznik
This creates a new file to store the original file labels.
Or do we want the whole functionality to reside in virtlockd?
Michal Privoznik (2):
security_dac: Keep original file label
security_dac: Lock label store file
src/Makefile.am | 3 +-
src/locking/lock_driver.h | 2 +
src/locking/lock_driver_lockd.c | 25 +++
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 3 +-
src/qemu/qemu_driver.c | 9 +-
src/security/security_dac.c | 412 +++++++++++++++++++++++++++++++++++----
src/security/security_manager.c | 24 ++-
src/security/security_manager.h | 7 +-
tests/qemuhotplugtest.c | 2 +-
tests/seclabeltest.c | 2 +-
tests/securityselinuxlabeltest.c | 3 +-
tests/securityselinuxtest.c | 2 +-
13 files changed, 438 insertions(+), 58 deletions(-)
--
1.9.0
10 years, 8 months