mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
conf: storage: Don't emit empty <permissions> block
This commit is contained in:
parent
7c2d65dde2
commit
42dd6a993f
@ -1179,22 +1179,28 @@ virStoragePoolDefFormatBuf(virBufferPtr buf,
|
|||||||
|
|
||||||
virBufferEscapeString(buf, "<path>%s</path>\n", def->target.path);
|
virBufferEscapeString(buf, "<path>%s</path>\n", def->target.path);
|
||||||
|
|
||||||
virBufferAddLit(buf, "<permissions>\n");
|
if (def->target.perms.mode != (mode_t) -1 ||
|
||||||
virBufferAdjustIndent(buf, 2);
|
def->target.perms.uid != (uid_t) -1 ||
|
||||||
if (def->target.perms.mode != (mode_t) -1)
|
def->target.perms.gid != (gid_t) -1 ||
|
||||||
virBufferAsprintf(buf, "<mode>0%o</mode>\n",
|
def->target.perms.label) {
|
||||||
def->target.perms.mode);
|
virBufferAddLit(buf, "<permissions>\n");
|
||||||
if (def->target.perms.uid != (uid_t) -1)
|
virBufferAdjustIndent(buf, 2);
|
||||||
virBufferAsprintf(buf, "<owner>%d</owner>\n",
|
if (def->target.perms.mode != (mode_t) -1)
|
||||||
(int) def->target.perms.uid);
|
virBufferAsprintf(buf, "<mode>0%o</mode>\n",
|
||||||
if (def->target.perms.gid != (gid_t) -1)
|
def->target.perms.mode);
|
||||||
virBufferAsprintf(buf, "<group>%d</group>\n",
|
if (def->target.perms.uid != (uid_t) -1)
|
||||||
(int) def->target.perms.gid);
|
virBufferAsprintf(buf, "<owner>%d</owner>\n",
|
||||||
virBufferEscapeString(buf, "<label>%s</label>\n",
|
(int) def->target.perms.uid);
|
||||||
def->target.perms.label);
|
if (def->target.perms.gid != (gid_t) -1)
|
||||||
|
virBufferAsprintf(buf, "<group>%d</group>\n",
|
||||||
|
(int) def->target.perms.gid);
|
||||||
|
virBufferEscapeString(buf, "<label>%s</label>\n",
|
||||||
|
def->target.perms.label);
|
||||||
|
|
||||||
|
virBufferAdjustIndent(buf, -2);
|
||||||
|
virBufferAddLit(buf, "</permissions>\n");
|
||||||
|
}
|
||||||
|
|
||||||
virBufferAdjustIndent(buf, -2);
|
|
||||||
virBufferAddLit(buf, "</permissions>\n");
|
|
||||||
virBufferAdjustIndent(buf, -2);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</target>\n");
|
virBufferAddLit(buf, "</target>\n");
|
||||||
}
|
}
|
||||||
@ -1513,7 +1519,11 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
|
|||||||
virBufferAsprintf(buf, "<format type='%s'/>\n", format);
|
virBufferAsprintf(buf, "<format type='%s'/>\n", format);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->perms) {
|
if (def->perms &&
|
||||||
|
(def->perms->mode != (mode_t) -1 ||
|
||||||
|
def->perms->uid != (uid_t) -1 ||
|
||||||
|
def->perms->gid != (gid_t) -1 ||
|
||||||
|
def->perms->label)) {
|
||||||
virBufferAddLit(buf, "<permissions>\n");
|
virBufferAddLit(buf, "<permissions>\n");
|
||||||
virBufferAdjustIndent(buf, 2);
|
virBufferAdjustIndent(buf, 2);
|
||||||
|
|
||||||
|
@ -11,7 +11,5 @@
|
|||||||
</source>
|
</source>
|
||||||
<target>
|
<target>
|
||||||
<path>/mnt/gluster</path>
|
<path>/mnt/gluster</path>
|
||||||
<permissions>
|
|
||||||
</permissions>
|
|
||||||
</target>
|
</target>
|
||||||
</pool>
|
</pool>
|
||||||
|
@ -8,7 +8,5 @@
|
|||||||
<target>
|
<target>
|
||||||
<path>gluster://example.com/vol/dir</path>
|
<path>gluster://example.com/vol/dir</path>
|
||||||
<format type='dir'/>
|
<format type='dir'/>
|
||||||
<permissions>
|
|
||||||
</permissions>
|
|
||||||
</target>
|
</target>
|
||||||
</volume>
|
</volume>
|
||||||
|
@ -7,7 +7,5 @@
|
|||||||
<target>
|
<target>
|
||||||
<path>sheepdog:test2</path>
|
<path>sheepdog:test2</path>
|
||||||
<format type='unknown'/>
|
<format type='unknown'/>
|
||||||
<permissions>
|
|
||||||
</permissions>
|
|
||||||
</target>
|
</target>
|
||||||
</volume>
|
</volume>
|
||||||
|
Loading…
Reference in New Issue
Block a user