mirror of https://gitee.com/openkylin/libvirt.git
storage: conf: Don't output owner/group -1
-1 is just an internal placeholder and is meaningless to output in the XML.
This commit is contained in:
parent
b903b3b01e
commit
c4d27bdddf
|
@ -101,18 +101,22 @@
|
|||
<element name='mode'>
|
||||
<ref name='octalMode'/>
|
||||
</element>
|
||||
<optional>
|
||||
<element name='owner'>
|
||||
<choice>
|
||||
<ref name='unsignedInt'/>
|
||||
<value>-1</value>
|
||||
</choice>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name='group'>
|
||||
<choice>
|
||||
<ref name='unsignedInt'/>
|
||||
<value>-1</value>
|
||||
</choice>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name='label'>
|
||||
<text/>
|
||||
|
|
|
@ -759,6 +759,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
|
|||
if (virXPathNode("./owner", ctxt) == NULL) {
|
||||
perms->uid = (uid_t) -1;
|
||||
} else {
|
||||
/* We previously could output -1, so continue to parse it */
|
||||
if (virXPathLongLong("number(./owner)", ctxt, &val) < 0 ||
|
||||
((uid_t)val != val &&
|
||||
val != -1)) {
|
||||
|
@ -773,6 +774,7 @@ virStorageDefParsePerms(xmlXPathContextPtr ctxt,
|
|||
if (virXPathNode("./group", ctxt) == NULL) {
|
||||
perms->gid = (gid_t) -1;
|
||||
} else {
|
||||
/* We previously could output -1, so continue to parse it */
|
||||
if (virXPathLongLong("number(./group)", ctxt, &val) < 0 ||
|
||||
((gid_t) val != val &&
|
||||
val != -1)) {
|
||||
|
@ -1187,8 +1189,10 @@ virStoragePoolDefFormatBuf(virBufferPtr buf,
|
|||
virBufferAdjustIndent(buf, 2);
|
||||
virBufferAsprintf(buf, "<mode>0%o</mode>\n",
|
||||
def->target.perms.mode);
|
||||
if (def->target.perms.uid != (uid_t) -1)
|
||||
virBufferAsprintf(buf, "<owner>%d</owner>\n",
|
||||
(int) def->target.perms.uid);
|
||||
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",
|
||||
|
@ -1522,12 +1526,13 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
|
|||
|
||||
virBufferAsprintf(buf, "<mode>0%o</mode>\n",
|
||||
def->perms->mode);
|
||||
if (def->perms->uid != (uid_t) -1)
|
||||
virBufferAsprintf(buf, "<owner>%d</owner>\n",
|
||||
(int) def->perms->uid);
|
||||
if (def->perms->gid != (gid_t) -1)
|
||||
virBufferAsprintf(buf, "<group>%d</group>\n",
|
||||
(int) def->perms->gid);
|
||||
|
||||
|
||||
virBufferEscapeString(buf, "<label>%s</label>\n",
|
||||
def->perms->label);
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
<path>/var/lib/libvirt/<images></path>
|
||||
<permissions>
|
||||
<mode>0700</mode>
|
||||
<owner>-1</owner>
|
||||
<group>-1</group>
|
||||
<label>some_label_t</label>
|
||||
</permissions>
|
||||
</target>
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
<path>/var/lib/libvirt/images</path>
|
||||
<permissions>
|
||||
<mode>0700</mode>
|
||||
<owner>-1</owner>
|
||||
<group>-1</group>
|
||||
<label>some_label_t</label>
|
||||
</permissions>
|
||||
</target>
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
<path>/mnt/gluster</path>
|
||||
<permissions>
|
||||
<mode>0755</mode>
|
||||
<owner>-1</owner>
|
||||
<group>-1</group>
|
||||
</permissions>
|
||||
</target>
|
||||
</pool>
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
<format type='dir'/>
|
||||
<permissions>
|
||||
<mode>0600</mode>
|
||||
<owner>-1</owner>
|
||||
<group>-1</group>
|
||||
</permissions>
|
||||
</target>
|
||||
</volume>
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
<format type='dir'/>
|
||||
<permissions>
|
||||
<mode>0600</mode>
|
||||
<owner>-1</owner>
|
||||
<group>-1</group>
|
||||
</permissions>
|
||||
</target>
|
||||
</volume>
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
<format type='unknown'/>
|
||||
<permissions>
|
||||
<mode>0600</mode>
|
||||
<owner>-1</owner>
|
||||
<group>-1</group>
|
||||
</permissions>
|
||||
</target>
|
||||
</volume>
|
||||
|
|
Loading…
Reference in New Issue