mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +03:00
seclabel: Do not output relabel attribute for type 'none'
Security label type 'none' requires relabel to be set to 'no' so there's no reason to output this extra attribute. Moreover, since relabel is internally stored in a negative from (norelabel), the default value for relabel would be 'yes' in case there is no <seclabel> element in domain configuration. In case VIR_DOMAIN_SECLABEL_DEFAULT turns into VIR_DOMAIN_SECLABEL_NONE, we would incorrectly output relabel='yes' for seclabel type 'none'.
This commit is contained in:
parent
c8683f231d
commit
f6957617c5
@ -9948,16 +9948,17 @@ virSecurityLabelDefFormat(virBufferPtr buf, virSecurityLabelDefPtr def)
|
||||
|
||||
virBufferAsprintf(buf, "<seclabel type='%s'",
|
||||
sectype);
|
||||
virBufferEscapeString(buf, " model='%s'", def->model);
|
||||
|
||||
virBufferAsprintf(buf, " relabel='%s'",
|
||||
def->norelabel ? "no" : "yes");
|
||||
|
||||
if (def->type == VIR_DOMAIN_SECLABEL_NONE) {
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
virBufferEscapeString(buf, " model='%s'", def->model);
|
||||
|
||||
virBufferAsprintf(buf, " relabel='%s'",
|
||||
def->norelabel ? "no" : "yes");
|
||||
|
||||
if (def->label || def->imagelabel || def->baselabel) {
|
||||
virBufferAddLit(buf, ">\n");
|
||||
|
||||
|
@ -22,5 +22,5 @@
|
||||
<controller type='ide' index='0'/>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
<seclabel type='none' relabel='no'/>
|
||||
<seclabel type='none'/>
|
||||
</domain>
|
||||
|
Loading…
Reference in New Issue
Block a user