Rush has submitted this change and it was merged.

Change subject: labstore: use secondary interface for DRBD replication
......................................................................


labstore: use secondary interface for DRBD replication

* Assign IP as reserved in DNS
* Put the right ip in the right place
* Use it as the peer identifier for the config

Change-Id: I404f340f23db4bb49e99240c2d88cf989b3f17c9
---
M modules/labstore/manifests/drbd/resource.pp
M modules/labstore/templates/drbd/drbd_resource.res.erb
M modules/role/manifests/labs/nfs/secondary.pp
3 files changed, 51 insertions(+), 18 deletions(-)

Approvals:
  Rush: Verified; Looks good to me, approved
  Madhuvishy: Looks good to me, but someone else must approve



diff --git a/modules/labstore/manifests/drbd/resource.pp 
b/modules/labstore/manifests/drbd/resource.pp
index 2f68b73..e1d41e9 100644
--- a/modules/labstore/manifests/drbd/resource.pp
+++ b/modules/labstore/manifests/drbd/resource.pp
@@ -22,6 +22,11 @@
 #  Array with 2 values containing the node names where the resources are
 #  meant to be available. Typically one of these nodes will be designated
 #  primary, and the other secondary.
+#  ** must match $::hostname
+#
+# [*addresses]
+#  Array of resolvable fqdn to peer with for DRBD (is translated to IP), can 
be the same
+#  as nodes definitons or distinct.
 #
 # [*port]
 #  Integer port number for DRBD TCP connections. Needs to be unique for
@@ -35,15 +40,17 @@
 #
 # Example:
 # labstore::drbd_resource {'myresource':
-#     nodes  => ['host1', 'host2'],
-#     port   => 7788,
-#     device => '/dev/drbd1',
-#     disk   => '/dev/misc/blockdevice',
+#     nodes   => ['host1', 'host2'],
+#     addresses => ['eth1.host1', 'eth1.host2'],
+#     port    => 7788,
+#     device  => '/dev/drbd1',
+#     disk    => '/dev/misc/blockdevice',
 # }
 #
 
 define labstore::drbd::resource (
     $nodes,
+    $addresses,
     $port,
     $device,
     $disk,
diff --git a/modules/labstore/templates/drbd/drbd_resource.res.erb 
b/modules/labstore/templates/drbd/drbd_resource.res.erb
index 2be0ae5..6bb4027 100644
--- a/modules/labstore/templates/drbd/drbd_resource.res.erb
+++ b/modules/labstore/templates/drbd/drbd_resource.res.erb
@@ -2,14 +2,14 @@
 
   on <%= @nodes.first %> {
     device    <%= @device %>;
-    address   <%= scope.function_ipresolve([@nodes.first, 4]) %>:<%= @port %>;
+    address   <%= scope.function_ipresolve([@addresses.first, 4]) %>:<%= @port 
%>;
     disk      <%= @disk %>;
     meta-disk internal;
   }
 
   on <%= @nodes.last %> {
     device    <%= @device %>;
-    address   <%= scope.function_ipresolve([@nodes.last, 4]) %>:<%= @port %>;
+    address   <%= scope.function_ipresolve([@addresses.last, 4]) %>:<%= @port 
%>;
     disk      <%= @disk %>;
     meta-disk internal;
   }
diff --git a/modules/role/manifests/labs/nfs/secondary.pp 
b/modules/role/manifests/labs/nfs/secondary.pp
index fad8b3d..104120f 100644
--- a/modules/role/manifests/labs/nfs/secondary.pp
+++ b/modules/role/manifests/labs/nfs/secondary.pp
@@ -11,24 +11,50 @@
     # Enable RPS to balance IRQs over CPUs
     interface::rps { $monitor: }
 
+    if $::hostname == 'labstore1005' {
+        interface::ip { 'drbd-replication':
+            interface => 'eth1',
+            address   => '10.64.37.26',
+            prefixlen => '24',
+        }
+    }
+
+    if $::hostname == 'labstore1004' {
+        interface::ip { 'drbd-replication':
+            interface => 'eth1',
+            address   => '10.64.37.25',
+            prefixlen => '24',
+        }
+    }
+
+    $nodes = ['labstore1004', 'labstore1005']
+    $addresses = ['eth1.labstore1004.eqiad.wmnet',
+                  'eth1.labstore1005.eqiad.wmnet']
+
     labstore::drbd::resource {'test':
-        nodes  => ['labstore1004', 'labstore1005'],
-        port   => '7790',
-        device => '/dev/drbd1',
-        disk   => '/dev/misc/test',
+        nodes     => $nodes,
+        addresses => $addresses,
+        port      => '7790',
+        device    => '/dev/drbd1',
+        disk      => '/dev/misc/test',
+        require   => Interface::Ip['drbd-replication'],
     }
 
     labstore::drbd::resource {'tools':
-        nodes  => ['labstore1004', 'labstore1005'],
-        port   => '7791',
-        device => '/dev/drbd2',
-        disk   => '/dev/tools-project/tools-project',
+        nodes     => $nodes,
+        addresses => $addresses,
+        port      => '7791',
+        device    => '/dev/drbd2',
+        disk      => '/dev/tools-project/tools-project',
+        require   => Interface::Ip['drbd-replication'],
     }
 
     labstore::drbd::resource {'others':
-        nodes  => ['labstore1004', 'labstore1005'],
-        port   => '7792',
-        device => '/dev/drbd3',
-        disk   => '/dev/misc/others',
+        nodes     => $nodes,
+        addresses => $addresses,
+        port      => '7792',
+        device    => '/dev/drbd3',
+        disk      => '/dev/misc/others',
+        require   => Interface::Ip['drbd-replication'],
     }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/311732
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I404f340f23db4bb49e99240c2d88cf989b3f17c9
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Rush <r...@wikimedia.org>
Gerrit-Reviewer: Madhuvishy <mviswanat...@wikimedia.org>
Gerrit-Reviewer: Rush <r...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to