diff --git a/htest/Test/Ganeti/Luxi.hs b/htest/Test/Ganeti/Luxi.hs
index 81698b08ddeff41197aceed96c4a21cccd394692..8e01bcc9ff7c14871f64d10909114099991d90d2 100644
--- a/htest/Test/Ganeti/Luxi.hs
+++ b/htest/Test/Ganeti/Luxi.hs
@@ -50,8 +50,6 @@ import qualified Ganeti.Luxi as Luxi
 
 -- * Luxi tests
 
-$(genArbitrary ''Luxi.TagObject)
-
 $(genArbitrary ''Luxi.LuxiReq)
 
 instance Arbitrary Luxi.LuxiOp where
diff --git a/htest/Test/Ganeti/OpCodes.hs b/htest/Test/Ganeti/OpCodes.hs
index 43a0e0ec7f3f920bed88ab1b1f5bdaeec8fe9fc4..daebf4d5d540ca2f63b463ffb5a6a5ae0b0c0fb3 100644
--- a/htest/Test/Ganeti/OpCodes.hs
+++ b/htest/Test/Ganeti/OpCodes.hs
@@ -48,6 +48,8 @@ import qualified Ganeti.OpCodes as OpCodes
 
 -- * Arbitrary instances
 
+$(genArbitrary ''OpCodes.TagObject)
+
 $(genArbitrary ''OpCodes.ReplaceDisksMode)
 
 instance Arbitrary OpCodes.DiskIndex where
diff --git a/htools/Ganeti/Luxi.hs b/htools/Ganeti/Luxi.hs
index 7531d7cad0738da06aaa5c6e8f244b96f546d3e9..b933eb5c3002f0bdc62324aa514600ec80dc4f06 100644
--- a/htools/Ganeti/Luxi.hs
+++ b/htools/Ganeti/Luxi.hs
@@ -31,7 +31,6 @@ module Ganeti.Luxi
   , Client
   , JobId
   , RecvResult(..)
-  , TagObject(..)
   , strOfOp
   , getClient
   , getServer
@@ -73,7 +72,7 @@ import Ganeti.Constants
 import Ganeti.Errors
 import Ganeti.JSON
 import Ganeti.Jobs (JobStatus)
-import Ganeti.OpCodes (OpCode)
+import Ganeti.OpCodes
 import Ganeti.Utils
 import qualified Ganeti.Query.Language as Qlang
 import Ganeti.THH
@@ -99,15 +98,6 @@ data RecvResult = RecvConnClosed    -- ^ Connection closed
 -- | The Ganeti job type.
 type JobId = Int
 
--- | Data type representing what items do the tag operations apply to.
-$(declareSADT "TagObject"
-  [ ("TagInstance", 'tagInstance)
-  , ("TagNode",     'tagNode)
-  , ("TagGroup",    'tagNodegroup)
-  , ("TagCluster",  'tagCluster)
-  ])
-$(makeJSONInstance ''TagObject)
-
 -- | Currently supported Luxi operations and JSON serialization.
 $(genLuxiOp "LuxiOp"
   [ (luxiReqQuery,
diff --git a/htools/Ganeti/OpCodes.hs b/htools/Ganeti/OpCodes.hs
index 566c5dbeca11b3105727151eb2ae979629f39e14..6daa6e69091f19cfd32a038630dad5da184227c0 100644
--- a/htools/Ganeti/OpCodes.hs
+++ b/htools/Ganeti/OpCodes.hs
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
 module Ganeti.OpCodes
   ( OpCode(..)
+  , TagObject(..)
   , ReplaceDisksMode(..)
   , DiskIndex
   , mkDiskIndex
@@ -42,6 +43,15 @@ import Ganeti.THH
 
 import Ganeti.JSON
 
+-- | Data type representing what items do the tag operations apply to.
+$(declareSADT "TagObject"
+  [ ("TagInstance", 'C.tagInstance)
+  , ("TagNode",     'C.tagNode)
+  , ("TagGroup",    'C.tagNodegroup)
+  , ("TagCluster",  'C.tagCluster)
+  ])
+$(makeJSONInstance ''TagObject)
+
 -- | Replace disks type.
 $(declareSADT "ReplaceDisksMode"
   [ ("ReplaceOnPrimary",    'C.replaceDiskPri)
diff --git a/htools/Ganeti/Query/Server.hs b/htools/Ganeti/Query/Server.hs
index 06243ddddd6859bdf7765df62e1ea26657fa450c..91aa745ca93cb272542743dbfc87938e56aad4a3 100644
--- a/htools/Ganeti/Query/Server.hs
+++ b/htools/Ganeti/Query/Server.hs
@@ -50,6 +50,7 @@ import qualified Ganeti.Config as Config
 import Ganeti.BasicTypes
 import Ganeti.Logging
 import Ganeti.Luxi
+import Ganeti.OpCodes (TagObject(..))
 import qualified Ganeti.Query.Language as Qlang
 import Ganeti.Query.Query
 import Ganeti.Query.Filter (makeSimpleFilter)