创建密码保护的 Samba 存储池

Create password protected Samba storage pool

<pool type="netfs">
  <name>virtimages</name>
  <source>
    <host name="0.0.0.0"/>
    <dir path="/var/lib/virt/images"/>
    <format type='cifs'/>
  </source>
  <target>
    <path>/var/lib/virt/images</path>
  </target>
</pool>

以上libvirt XML配置可用于创建Samba存储池,但如何创建受密码保护的Samba存储池?

您必须在源代码中添加一个授权部分,例如:

  <name>YourStorage</name>
  <source>
    <host name="storage.example.com" />
    <dir path="/backup" />
    <format type="cifs" />
    <auth type='chap' username='SomeSecretUsername'>
      <secret usage='SomeSecretPass'/>
    </auth>
  </source>
  <target>
    <path>/mnt/storage</path>
  </target>
</pool>```

See: https://libvirt.org/formatstorage.html#StoragePoolSource