mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
lxc domain from xml: convert lxc.cap.drop
This commit is contained in:
parent
47e5b5ae32
commit
26d67015b8
@ -853,6 +853,28 @@ lxcSetBlkioTune(virDomainDefPtr def, virConfPtr properties)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties)
|
||||
{
|
||||
virConfValuePtr value;
|
||||
char **toDrop = NULL;
|
||||
const char *capString;
|
||||
size_t i;
|
||||
|
||||
if ((value = virConfGetValue(properties, "lxc.cap.drop")) && value->str)
|
||||
toDrop = virStringSplit(value->str, " ", 0);
|
||||
|
||||
for (i = 0; i < VIR_DOMAIN_CAPS_FEATURE_LAST; i++) {
|
||||
capString = virDomainCapsFeatureTypeToString(i);
|
||||
if (toDrop != NULL && virStringArrayHasString(toDrop, capString))
|
||||
def->caps_features[i] = VIR_DOMAIN_FEATURE_STATE_OFF;
|
||||
}
|
||||
|
||||
def->features[VIR_DOMAIN_FEATURE_CAPABILITIES] = VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW;
|
||||
|
||||
virStringFreeList(toDrop);
|
||||
}
|
||||
|
||||
virDomainDefPtr
|
||||
lxcParseConfigString(const char *config)
|
||||
{
|
||||
@ -950,6 +972,9 @@ lxcParseConfigString(const char *config)
|
||||
if (lxcSetBlkioTune(vmdef, properties) < 0)
|
||||
goto error;
|
||||
|
||||
/* lxc.cap.drop */
|
||||
lxcSetCapDrop(vmdef, properties);
|
||||
|
||||
goto cleanup;
|
||||
|
||||
error:
|
||||
|
@ -25,6 +25,8 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -13,6 +13,8 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -15,6 +15,8 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -14,6 +14,8 @@
|
||||
</idmap>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -8,6 +8,10 @@
|
||||
<type>exe</type>
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
@ -15,6 +15,8 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -8,6 +8,10 @@
|
||||
<type>exe</type>
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
@ -10,6 +10,8 @@
|
||||
</os>
|
||||
<features>
|
||||
<privnet/>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
|
@ -8,6 +8,10 @@
|
||||
<type>exe</type>
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
@ -8,6 +8,14 @@
|
||||
<type arch='i686'>exe</type>
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
<mac_admin state='off'/>
|
||||
<mac_override state='off'/>
|
||||
<mknod state='off'/>
|
||||
<sys_module state='off'/>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
@ -8,6 +8,10 @@
|
||||
<type>exe</type>
|
||||
<init>/sbin/init</init>
|
||||
</os>
|
||||
<features>
|
||||
<capabilities policy='allow'>
|
||||
</capabilities>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
Loading…
Reference in New Issue
Block a user