lxc domain from xml: convert lxc.cap.drop

This commit is contained in:
Cédric Bosdonnat 2014-07-18 10:02:30 +02:00 committed by Gao feng
parent 47e5b5ae32
commit 26d67015b8
12 changed files with 61 additions and 0 deletions

View File

@ -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:

View File

@ -25,6 +25,8 @@
</os>
<features>
<privnet/>
<capabilities policy='allow'>
</capabilities>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -13,6 +13,8 @@
</os>
<features>
<privnet/>
<capabilities policy='allow'>
</capabilities>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -15,6 +15,8 @@
</os>
<features>
<privnet/>
<capabilities policy='allow'>
</capabilities>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -14,6 +14,8 @@
</idmap>
<features>
<privnet/>
<capabilities policy='allow'>
</capabilities>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -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>

View File

@ -15,6 +15,8 @@
</os>
<features>
<privnet/>
<capabilities policy='allow'>
</capabilities>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -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>

View File

@ -10,6 +10,8 @@
</os>
<features>
<privnet/>
<capabilities policy='allow'>
</capabilities>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>

View File

@ -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>

View File

@ -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>

View File

@ -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>