Commit 926feaf1 authored by Manuel Franceschini's avatar Manuel Franceschini
Browse files

Use reserved documentation IPs and domains



Use RFC 5737 IP addresses and RFC 2606 domain names in all
unittests, docs, qa and docstrings.
Signed-off-by: default avatarManuel Franceschini <livewire@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 7b4c1cb9
......@@ -18,7 +18,7 @@
# 02110-1301, USA.
# To set user mappings, use this command:
# git config gnt-review.johndoe 'John Doe <johndoe@domain.tld>'
# git config gnt-review.johndoe 'John Doe <johndoe@example.com>'
# To disable strict mode (enabled by default):
# git config gnt-review.strict false
......
......@@ -375,8 +375,8 @@ Input message, new instance allocation::
"nodes": {
"node1.example.com": {
"total_disk": 858276,
"primary_ip": "192.168.1.1",
"secondary_ip": "192.168.2.1",
"primary_ip": "198.51.100.1",
"secondary_ip": "192.0.2.1",
"tags": [],
"free_memory": 3505,
"free_disk": 856740,
......@@ -384,8 +384,8 @@ Input message, new instance allocation::
},
"node2.example.com": {
"total_disk": 858240,
"primary_ip": "192.168.1.3",
"secondary_ip": "192.168.2.3",
"primary_ip": "198.51.100.2",
"secondary_ip": "192.0.2.2",
"tags": ["test"],
"free_memory": 3505,
"free_disk": 848320,
......@@ -393,8 +393,8 @@ Input message, new instance allocation::
},
"node3.example.com.com": {
"total_disk": 572184,
"primary_ip": "192.168.1.3",
"secondary_ip": "192.168.2.3",
"primary_ip": "198.51.100.3",
"secondary_ip": "192.0.2.3",
"tags": [],
"free_memory": 3505,
"free_disk": 570648,
......
......@@ -98,9 +98,9 @@ and not just *node1*.
but for Ganeti you need to have::
127.0.0.1 localhost
192.168.1.1 node1.example.com node1
192.0.2.1 node1.example.com node1
replacing ``192.168.1.1`` with your node's address. Also, the file
replacing ``192.0.2.1`` with your node's address. Also, the file
``/etc/hostname`` which configures the hostname of the system
should contain ``node1.example.com`` and not just ``node1`` (you
need to run the command ``/etc/init.d/hostname.sh start`` after
......@@ -179,13 +179,13 @@ other. For example::
(xend-relocation-server yes)
(xend-relocation-port 8002)
(xend-relocation-address '')
(xend-relocation-hosts-allow '^192\\.168\\.3\\.[0-9]+$')
(xend-relocation-hosts-allow '^192\\.0\\.2\\.[0-9]+$')
The second line assumess that the hypervisor parameter
``migration_port`` is set 8002, otherwise modify it to match. The last
line assumes that all your nodes have secondary IPs in the
192.168.3.0/24 network, adjust it accordingly to your setup.
192.0.2.0/24 network, adjust it accordingly to your setup.
.. admonition:: Debian
......
......@@ -388,8 +388,8 @@ Body parameters:
``rw``).
``nics`` (list, required)
List of NIC (network interface) definitions. Example: ``[{}, {},
{"ip": "1.2.3.4"}]``. Each NIC definition can contain the optional
values ``ip``, ``mode``, ``link`` and ``bridge``.
{"ip": "198.51.100.4"}]``. Each NIC definition can contain the
optional values ``ip``, ``mode``, ``link`` and ``bridge``.
``os`` (string)
Instance operating system.
``force_variant`` (bool)
......
......@@ -17,7 +17,7 @@ a step-by-step example to managing instances and the cluster.
Our simulated, example cluster will have three machines, named
``node1``, ``node2``, ``node3``. Note that in real life machines will
usually FQDNs but here we use short names for brevity. We will use a
secondary network for replication data, ``192.168.2.0/24``, with nodes
secondary network for replication data, ``192.0.2.0/24``, with nodes
having the last octet the same as their index. The cluster name will be
``example-cluster``. All nodes have the same simulated hardware
configuration, two disks of 750GB, 32GB of memory and 4 CPUs.
......@@ -32,7 +32,7 @@ Cluster creation
Follow the :doc:`install` document and prepare the nodes. Then it's time
to initialise the cluster::
node1# gnt-cluster init -s 192.168.2.1 --enabled-hypervisors=xen-pvm cluster
node1# gnt-cluster init -s 192.0.2.1 --enabled-hypervisors=xen-pvm example-cluster
node1#
The creation was fine. Let's check that one node we have is functioning
......@@ -55,24 +55,24 @@ correctly::
Since this proceeded correctly, let's add the other two nodes::
node1# gnt-node add -s 192.168.2.2 node2
node1# gnt-node add -s 192.0.2.2 node2
-- WARNING --
Performing this operation is going to replace the ssh daemon keypair
on the target machine (node2) with the ones of the current one
and grant full intra-cluster ssh root access to/from it
The authenticity of host 'node2 (192.168.1.2)' can't be established.
The authenticity of host 'node2 (192.0.2.2)' can't be established.
RSA key fingerprint is 9f:…
Are you sure you want to continue connecting (yes/no)? yes
root@node2's password:
Mon Oct 26 02:11:54 2009 - INFO: Node will be a master candidate
node1# gnt-node add -s 192.168.2.3 node3
node1# gnt-node add -s 192.0.2.3 node3
-- WARNING --
Performing this operation is going to replace the ssh daemon keypair
on the target machine (node2) with the ones of the current one
and grant full intra-cluster ssh root access to/from it
The authenticity of host 'node3 (192.168.1.3)' can't be established.
The authenticity of host 'node3 (192.0.2.3)' can't be established.
RSA key fingerprint is 9f:…
Are you sure you want to continue connecting (yes/no)? yes
root@node2's password:
......@@ -378,8 +378,8 @@ which has one primary and one secondary instance, crashes::
node1# gnt-node info node3
Node name: node3
primary ip: 172.24.227.1
secondary ip: 192.168.2.3
primary ip: 198.51.100.1
secondary ip: 192.0.2.3
master candidate: True
drained: False
offline: False
......@@ -578,7 +578,7 @@ Let's say node3 has been repaired and is now ready to be
reused. Re-adding it is simple::
node1# gnt-node add --readd node3
The authenticity of host 'node3 (172.24.227.1)' can't be established.
The authenticity of host 'node3 (198.51.100.1)' can't be established.
RSA key fingerprint is 9f:2e:5a:2e:e0:bd:00:09:e4:5c:32:f2:27:57:7a:f4.
Are you sure you want to continue connecting (yes/no)? yes
Mon Oct 26 05:27:39 2009 - INFO: Readding a node, the offline/drained flags were reset
......
......@@ -379,11 +379,11 @@ class LogicalUnit(object):
# Acquire all nodes and one instance
self.needed_locks = {
locking.LEVEL_NODE: locking.ALL_SET,
locking.LEVEL_INSTANCE: ['instance1.example.tld'],
locking.LEVEL_INSTANCE: ['instance1.example.com'],
}
# Acquire just two nodes
self.needed_locks = {
locking.LEVEL_NODE: ['node1.example.tld', 'node2.example.tld'],
locking.LEVEL_NODE: ['node1.example.com', 'node2.example.com'],
}
# Acquire no locks
self.needed_locks = {} # No, you can't leave it to the default value None
......
......@@ -107,7 +107,7 @@
Example:
<screen>
# gnt-node add node5.example.com
# gnt-node add -s 192.168.44.5 node5.example.com
# gnt-node add -s 192.0.2.5 node5.example.com
</screen>
</para>
</refsect2>
......
......@@ -14,12 +14,12 @@
{
"# Master node": null,
"primary": "xen-test-0",
"secondary": "192.168.1.1"
"secondary": "192.0.2.1"
},
{
"primary": "xen-test-1",
"secondary": "192.168.1.2"
"secondary": "192.0.2.2"
}
],
......
......@@ -28,8 +28,8 @@ _this_host {
device "/dev/drbd63";
disk "/dev/xenvg/test.data";
meta-disk "/dev/xenvg/test.meta" [ 0 ];
address 192.168.1.1:11000;
address 192.0.2.1:11000;
}
_remote_host {
address 192.168.1.2:11000;
address 192.0.2.2:11000;
}
......@@ -29,8 +29,8 @@ _this_host {
device minor 0;
disk "/dev/xenvg/test.data";
meta-disk "/dev/xenvg/test.meta" [ 0 ];
address ipv4 192.168.1.1:11000;
address ipv4 192.0.2.1:11000;
}
_remote_host {
address ipv4 192.168.1.2:11000;
address ipv4 192.0.2.2:11000;
}
......@@ -21,8 +21,8 @@ syncer {
protocol C;
_this_host {
device "/dev/drbd59";
address 192.168.1.1:11002;
address 192.0.2.1:11002;
}
_remote_host {
address 192.168.1.2:11002;
address 192.0.2.2:11002;
}
......@@ -82,7 +82,7 @@ class TestNodeVerify(testutils.GanetiTestCase):
def testMasterIPUnreachable(self):
# Network 192.0.2.0/24 is reserved for test/documentation as per
# RFC 5735
# RFC 5737
bad_data = ("master.example.com", "192.0.2.1")
# we just test that whatever TcpPing returns, VerifyNode returns too
netutils.TcpPing = lambda a, b, source=None: False
......
......@@ -69,8 +69,8 @@ class TestDRBD8Runner(testutils.GanetiTestCase):
self.failUnless(self._has_disk(result, "/dev/xenvg/test.data",
"/dev/xenvg/test.meta"),
"Wrong local disk info")
self.failUnless(self._has_net(result, ("192.168.1.1", 11000),
("192.168.1.2", 11000)),
self.failUnless(self._has_net(result, ("192.0.2.1", 11000),
("192.0.2.2", 11000)),
"Wrong network info (8.0.x)")
def testParser83(self):
......@@ -80,8 +80,8 @@ class TestDRBD8Runner(testutils.GanetiTestCase):
self.failUnless(self._has_disk(result, "/dev/xenvg/test.data",
"/dev/xenvg/test.meta"),
"Wrong local disk info")
self.failUnless(self._has_net(result, ("192.168.1.1", 11000),
("192.168.1.2", 11000)),
self.failUnless(self._has_net(result, ("192.0.2.1", 11000),
("192.0.2.2", 11000)),
"Wrong network info (8.0.x)")
def testParserNetIP4(self):
......@@ -92,8 +92,8 @@ class TestDRBD8Runner(testutils.GanetiTestCase):
"meta_dev" not in result and
"meta_index" not in result),
"Should not find local disk info")
self.failUnless(self._has_net(result, ("192.168.1.1", 11002),
("192.168.1.2", 11002)),
self.failUnless(self._has_net(result, ("192.0.2.1", 11002),
("192.0.2.2", 11002)),
"Wrong network info (IPv4)")
def testParserNetIP6(self):
......
......@@ -182,7 +182,7 @@ class _BaseClientTest:
def testSetPeersFamily(self):
self.client._SetPeersAddressFamily()
self.assertEquals(self.client._family, self.family)
mixed_peers = ["1.2.3.6", "2001:db8:beef::13"]
mixed_peers = ["192.0.2.99", "2001:db8:beef::13"]
self.client.UpdatePeerList(mixed_peers)
self.assertRaises(errors.ConfdClientError,
self.client._SetPeersAddressFamily)
......@@ -190,17 +190,17 @@ class _BaseClientTest:
class TestIP4Client(unittest.TestCase, _BaseClientTest):
"""Client tests"""
mc_list = ["10.0.0.1",
"10.0.0.2",
"10.0.0.3",
"10.0.0.4",
"10.0.0.5",
"10.0.0.6",
"10.0.0.7",
"10.0.0.8",
"10.0.0.9",
mc_list = ["192.0.2.1",
"192.0.2.2",
"192.0.2.3",
"192.0.2.4",
"192.0.2.5",
"192.0.2.6",
"192.0.2.7",
"192.0.2.8",
"192.0.2.9",
]
new_peers = ["1.2.3.4", "1.2.3.5"]
new_peers = ["198.51.100.1", "198.51.100.2"]
family = socket.AF_INET
def setUp(self):
......
......@@ -81,7 +81,7 @@ class TestCommandBuilder(unittest.TestCase):
else:
self.assertFalse(magic_cmd)
for host in ["localhost", "1.2.3.4", "192.0.2.99"]:
for host in ["localhost", "198.51.100.4", "192.0.2.99"]:
for port in [0, 1, 1234, 7856, 45452]:
for cmd_prefix in [None, "PrefixCommandGoesHere|",
"dd if=/dev/hda bs=1048576 |"]:
......
......@@ -335,7 +335,7 @@ class TestOwnIpAddress(unittest.TestCase):
"""check that I don't own an address"""
# Network 192.0.2.0/24 is reserved for test/documentation as per
# RFC 5735, so we *should* not have an address of this range... if
# RFC 5737, so we *should* not have an address of this range... if
# this fails, we should extend the test to multiple addresses
DST_IP = "192.0.2.1"
self.failIf(netutils.OwnIpAddress(DST_IP),
......
......@@ -67,7 +67,7 @@ class TestParseInstanceCreateRequestVersion1(testutils.GanetiTestCase):
# Two NICs
[
{ "ip": "1.2.3.4", "mode": constants.NIC_MODE_ROUTED, },
{ "ip": "192.0.2.6", "mode": constants.NIC_MODE_ROUTED, },
{ "mode": constants.NIC_MODE_BRIDGED, "link": "n0", "bridge": "br1", },
],
......
......@@ -999,7 +999,7 @@ class TestSshKeys(testutils.GanetiTestCase):
"""Test case for the AddAuthorizedKey function"""
KEY_A = 'ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a'
KEY_B = ('command="/usr/bin/fooserver -t --verbose",from="1.2.3.4" '
KEY_B = ('command="/usr/bin/fooserver -t --verbose",from="198.51.100.4" '
'ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b')
def setUp(self):
......@@ -1018,7 +1018,7 @@ class TestSshKeys(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n"
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n"
"ssh-dss AAAAB3NzaC1kc3MAAACB root@test\n")
......@@ -1028,7 +1028,7 @@ class TestSshKeys(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n"
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n"
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@test\n")
......@@ -1038,7 +1038,7 @@ class TestSshKeys(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n"
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n")
def testRemovingExistingKeyWithSomeMoreSpaces(self):
......@@ -1046,7 +1046,7 @@ class TestSshKeys(testutils.GanetiTestCase):
'ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a')
self.assertFileContent(self.tmpname,
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n")
def testRemovingNonExistingKey(self):
......@@ -1055,7 +1055,7 @@ class TestSshKeys(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n"
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n")
......@@ -1069,38 +1069,39 @@ class TestEtcHosts(testutils.GanetiTestCase):
try:
handle.write('# This is a test file for /etc/hosts\n')
handle.write('127.0.0.1\tlocalhost\n')
handle.write('192.168.1.1 router gw\n')
handle.write('192.0.2.1 router gw\n')
finally:
handle.close()
def testSettingNewIp(self):
SetEtcHostsEntry(self.tmpname, '1.2.3.4', 'myhost.domain.tld', ['myhost'])
SetEtcHostsEntry(self.tmpname, '198.51.100.4', 'myhost.example.com',
['myhost'])
self.assertFileContent(self.tmpname,
"# This is a test file for /etc/hosts\n"
"127.0.0.1\tlocalhost\n"
"192.168.1.1 router gw\n"
"1.2.3.4\tmyhost.domain.tld myhost\n")
"192.0.2.1 router gw\n"
"198.51.100.4\tmyhost.example.com myhost\n")
self.assertFileMode(self.tmpname, 0644)
def testSettingExistingIp(self):
SetEtcHostsEntry(self.tmpname, '192.168.1.1', 'myhost.domain.tld',
SetEtcHostsEntry(self.tmpname, '192.0.2.1', 'myhost.example.com',
['myhost'])
self.assertFileContent(self.tmpname,
"# This is a test file for /etc/hosts\n"
"127.0.0.1\tlocalhost\n"
"192.168.1.1\tmyhost.domain.tld myhost\n")
"192.0.2.1\tmyhost.example.com myhost\n")
self.assertFileMode(self.tmpname, 0644)
def testSettingDuplicateName(self):
SetEtcHostsEntry(self.tmpname, '1.2.3.4', 'myhost', ['myhost'])
SetEtcHostsEntry(self.tmpname, '198.51.100.4', 'myhost', ['myhost'])
self.assertFileContent(self.tmpname,
"# This is a test file for /etc/hosts\n"
"127.0.0.1\tlocalhost\n"
"192.168.1.1 router gw\n"
"1.2.3.4\tmyhost\n")
"192.0.2.1 router gw\n"
"198.51.100.4\tmyhost\n")
self.assertFileMode(self.tmpname, 0644)
def testRemovingExistingHost(self):
......@@ -1109,7 +1110,7 @@ class TestEtcHosts(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"# This is a test file for /etc/hosts\n"
"127.0.0.1\tlocalhost\n"
"192.168.1.1 gw\n")
"192.0.2.1 gw\n")
self.assertFileMode(self.tmpname, 0644)
def testRemovingSingleExistingHost(self):
......@@ -1117,7 +1118,7 @@ class TestEtcHosts(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"# This is a test file for /etc/hosts\n"
"192.168.1.1 router gw\n")
"192.0.2.1 router gw\n")
self.assertFileMode(self.tmpname, 0644)
def testRemovingNonExistingHost(self):
......@@ -1126,7 +1127,7 @@ class TestEtcHosts(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"# This is a test file for /etc/hosts\n"
"127.0.0.1\tlocalhost\n"
"192.168.1.1 router gw\n")
"192.0.2.1 router gw\n")
self.assertFileMode(self.tmpname, 0644)
def testRemovingAlias(self):
......@@ -1135,7 +1136,7 @@ class TestEtcHosts(testutils.GanetiTestCase):
self.assertFileContent(self.tmpname,
"# This is a test file for /etc/hosts\n"
"127.0.0.1\tlocalhost\n"
"192.168.1.1 router\n")
"192.0.2.1 router\n")
self.assertFileMode(self.tmpname, 0644)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment