From 4a2df064839f71ed94320771507b1271d041e397 Mon Sep 17 00:00:00 2001
From: Lin Ma <lma@suse.com>
Date: Wed, 2 Nov 2022 20:45:43 +0800
Subject: [PATCH] diskbackend: Drop support for sheepdog

The sheepdog project is no longer actively developed, Libvirt removed
the support for sheepdog storage backend since v8.8.0, Let's drop it.

Signed-off-by: Lin Ma <lma@suse.com>
---
 .../compare/virt-xml-build-disk-domain.xml    |  2 +-
 .../virt-xml-build-pool-logical-disk.xml      |  2 +-
 tests/data/testdriver/testdriver.xml          | 40 +------------------
 virtManager/object/storagepool.py             |  2 -
 virtinst/storage.py                           |  8 ++--
 5 files changed, 7 insertions(+), 47 deletions(-)

diff --git a/tests/data/cli/compare/virt-xml-build-disk-domain.xml b/tests/data/cli/compare/virt-xml-build-disk-domain.xml
index 1a08b20e..6d9f7160 100644
--- a/tests/data/cli/compare/virt-xml-build-disk-domain.xml
+++ b/tests/data/cli/compare/virt-xml-build-disk-domain.xml
@@ -1,5 +1,5 @@
 <disk type="file" device="disk">
   <driver name="qemu" type="qcow2"/>
   <source file="/pool-dir/testvol1.img"/>
-  <target dev="vdag" bus="virtio"/>
+  <target dev="vdaf" bus="virtio"/>
 </disk>
diff --git a/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml b/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml
index 055a8f04..49c9bd4a 100644
--- a/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml
+++ b/tests/data/cli/compare/virt-xml-build-pool-logical-disk.xml
@@ -1,5 +1,5 @@
 <disk type="volume" device="disk">
   <driver name="qemu" type="raw"/>
   <source volume="sdfg1" pool="pool-disk"/>
-  <target dev="vdag" bus="virtio"/>
+  <target dev="vdaf" bus="virtio"/>
 </disk>
diff --git a/tests/data/testdriver/testdriver.xml b/tests/data/testdriver/testdriver.xml
index 7c94e698..04476b22 100644
--- a/tests/data/testdriver/testdriver.xml
+++ b/tests/data/testdriver/testdriver.xml
@@ -294,26 +294,19 @@ Foo bar baz &amp; yeah boii &lt; &gt; yeahfoo
       </source>
       <target dev='vdac' bus='virtio'/>
     </disk>
-    <disk type='network' device='disk'>
-      <driver name='qemu' type='raw'/>
-      <source protocol='sheepdog' name='image,with,commas'>
-        <host name='example.org' port='6000'/>
-      </source>
-      <target dev='vdad' bus='virtio'/>
-    </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
       <source protocol='gluster' name='test-volume/test-gluster2.raw'>
         <host name='192.168.1.100'/>
       </source>
-      <target dev='vdae' bus='virtio'/>
+      <target dev='vdad' bus='virtio'/>
     </disk>
     <disk type='network' device='disk'>
       <driver name='qemu' type='raw'/>
       <source protocol='nbd'>
         <host transport='unix' socket='relative.sock'/>
       </source>
-      <target dev='vdaf' bus='virtio'/>
+      <target dev='vdae' bus='virtio'/>
     </disk>
 
     <!-- bus usb -->
@@ -2171,35 +2164,6 @@ ba</description>
 </pool>
 
 
-<pool type='sheepdog'>
-  <name>pool-sheepdog</name>
-  <uuid>581381f8-a13f-4f7c-89b5-9c9b71c64834</uuid>
-  <capacity unit='bytes'>107374182400</capacity>
-  <allocation unit='bytes'>53687091200</allocation>
-  <available unit='bytes'>53687091200</available>
-  <source>
-    <host name='localhost' port='7000'/>
-    <name>mysheeppool</name>
-  </source>
-
-  <volume type='network'>
-    <name>vol_sheepdog</name>
-    <key>sheep/vol_sheepdog</key>
-    <capacity unit='bytes'>1024</capacity>
-    <allocation unit='bytes'>0</allocation>
-    <target>
-      <path>sheepdog:vol_sheepdog</path>
-      <format type='unknown'/>
-      <permissions>
-        <mode>0600</mode>
-        <owner>-1</owner>
-        <group>-1</group>
-      </permissions>
-    </target>
-  </volume>
-</pool>
-
-
 <pool type='gluster'>
   <name>pool-gluster</name>
   <uuid>7b83ef6d-28da-44f1-841f-2011320f13b0</uuid>
diff --git a/virtManager/object/storagepool.py b/virtManager/object/storagepool.py
index 563526bb..1b4da515 100644
--- a/virtManager/object/storagepool.py
+++ b/virtManager/object/storagepool.py
@@ -32,7 +32,6 @@ POOL_TYPE_DESCS = {
     StoragePool.TYPE_MPATH: _("Multipath Device Enumerator"),
     StoragePool.TYPE_GLUSTER: _("Gluster Filesystem"),
     StoragePool.TYPE_RBD: _("RADOS Block Device/Ceph"),
-    StoragePool.TYPE_SHEEPDOG: _("Sheepdog Filesystem"),
     StoragePool.TYPE_ZFS: _("ZFS Pool"),
 }
 
@@ -128,7 +127,6 @@ class vmmStoragePool(vmmLibvirtObject):
         ]
         if not clone:
             supported.extend([
-                StoragePool.TYPE_SHEEPDOG,
                 StoragePool.TYPE_ZFS,
             ])
         return pool_type in supported
diff --git a/virtinst/storage.py b/virtinst/storage.py
index 509f5cb0..3c5d39bb 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -82,7 +82,6 @@ class StoragePool(_StorageObject):
     TYPE_MPATH   = "mpath"
     TYPE_GLUSTER = "gluster"
     TYPE_RBD     = "rbd"
-    TYPE_SHEEPDOG = "sheepdog"
     TYPE_ZFS     = "zfs"
 
     @staticmethod
@@ -311,7 +310,7 @@ class StoragePool(_StorageObject):
 
     def supports_source_name(self):
         return self.type in [self.TYPE_LOGICAL, self.TYPE_GLUSTER,
-            self.TYPE_RBD, self.TYPE_SHEEPDOG, self.TYPE_ZFS]
+            self.TYPE_RBD, self.TYPE_ZFS]
 
 
     def supports_source_path(self):
@@ -323,7 +322,7 @@ class StoragePool(_StorageObject):
     def supports_hosts(self):
         return self.type in [
                 self.TYPE_NETFS, self.TYPE_ISCSI, self.TYPE_GLUSTER,
-                self.TYPE_RBD, self.TYPE_SHEEPDOG]
+                self.TYPE_RBD]
 
     def supports_format(self):
         return self.type in [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_DISK]
@@ -340,8 +339,7 @@ class StoragePool(_StorageObject):
             return StorageVolume.TYPE_BLOCK
         if (self.type == StoragePool.TYPE_GLUSTER or
             self.type == StoragePool.TYPE_RBD or
-            self.type == StoragePool.TYPE_ISCSI or
-            self.type == StoragePool.TYPE_SHEEPDOG):
+            self.type == StoragePool.TYPE_ISCSI):
             return StorageVolume.TYPE_NETWORK
         return StorageVolume.TYPE_FILE
 
-- 
2.37.2.windows.2

