Revision 926feaf1
b/devel/review | ||
---|---|---|
18 | 18 |
# 02110-1301, USA. |
19 | 19 |
|
20 | 20 |
# To set user mappings, use this command: |
21 |
# git config gnt-review.johndoe 'John Doe <johndoe@domain.tld>'
|
|
21 |
# git config gnt-review.johndoe 'John Doe <johndoe@example.com>'
|
|
22 | 22 |
|
23 | 23 |
# To disable strict mode (enabled by default): |
24 | 24 |
# git config gnt-review.strict false |
b/doc/iallocator.rst | ||
---|---|---|
375 | 375 |
"nodes": { |
376 | 376 |
"node1.example.com": { |
377 | 377 |
"total_disk": 858276, |
378 |
"primary_ip": "192.168.1.1",
|
|
379 |
"secondary_ip": "192.168.2.1",
|
|
378 |
"primary_ip": "198.51.100.1",
|
|
379 |
"secondary_ip": "192.0.2.1",
|
|
380 | 380 |
"tags": [], |
381 | 381 |
"free_memory": 3505, |
382 | 382 |
"free_disk": 856740, |
... | ... | |
384 | 384 |
}, |
385 | 385 |
"node2.example.com": { |
386 | 386 |
"total_disk": 858240, |
387 |
"primary_ip": "192.168.1.3",
|
|
388 |
"secondary_ip": "192.168.2.3",
|
|
387 |
"primary_ip": "198.51.100.2",
|
|
388 |
"secondary_ip": "192.0.2.2",
|
|
389 | 389 |
"tags": ["test"], |
390 | 390 |
"free_memory": 3505, |
391 | 391 |
"free_disk": 848320, |
... | ... | |
393 | 393 |
}, |
394 | 394 |
"node3.example.com.com": { |
395 | 395 |
"total_disk": 572184, |
396 |
"primary_ip": "192.168.1.3",
|
|
397 |
"secondary_ip": "192.168.2.3",
|
|
396 |
"primary_ip": "198.51.100.3",
|
|
397 |
"secondary_ip": "192.0.2.3",
|
|
398 | 398 |
"tags": [], |
399 | 399 |
"free_memory": 3505, |
400 | 400 |
"free_disk": 570648, |
b/doc/install.rst | ||
---|---|---|
98 | 98 |
but for Ganeti you need to have:: |
99 | 99 |
|
100 | 100 |
127.0.0.1 localhost |
101 |
192.168.1.1 node1.example.com node1
|
|
101 |
192.0.2.1 node1.example.com node1
|
|
102 | 102 |
|
103 |
replacing ``192.168.1.1`` with your node's address. Also, the file
|
|
103 |
replacing ``192.0.2.1`` with your node's address. Also, the file
|
|
104 | 104 |
``/etc/hostname`` which configures the hostname of the system |
105 | 105 |
should contain ``node1.example.com`` and not just ``node1`` (you |
106 | 106 |
need to run the command ``/etc/init.d/hostname.sh start`` after |
... | ... | |
179 | 179 |
(xend-relocation-server yes) |
180 | 180 |
(xend-relocation-port 8002) |
181 | 181 |
(xend-relocation-address '') |
182 |
(xend-relocation-hosts-allow '^192\\.168\\.3\\.[0-9]+$')
|
|
182 |
(xend-relocation-hosts-allow '^192\\.0\\.2\\.[0-9]+$')
|
|
183 | 183 |
|
184 | 184 |
|
185 | 185 |
The second line assumess that the hypervisor parameter |
186 | 186 |
``migration_port`` is set 8002, otherwise modify it to match. The last |
187 | 187 |
line assumes that all your nodes have secondary IPs in the |
188 |
192.168.3.0/24 network, adjust it accordingly to your setup.
|
|
188 |
192.0.2.0/24 network, adjust it accordingly to your setup.
|
|
189 | 189 |
|
190 | 190 |
.. admonition:: Debian |
191 | 191 |
|
b/doc/rapi.rst | ||
---|---|---|
388 | 388 |
``rw``). |
389 | 389 |
``nics`` (list, required) |
390 | 390 |
List of NIC (network interface) definitions. Example: ``[{}, {}, |
391 |
{"ip": "1.2.3.4"}]``. Each NIC definition can contain the optional
|
|
392 |
values ``ip``, ``mode``, ``link`` and ``bridge``. |
|
391 |
{"ip": "198.51.100.4"}]``. Each NIC definition can contain the
|
|
392 |
optional values ``ip``, ``mode``, ``link`` and ``bridge``.
|
|
393 | 393 |
``os`` (string) |
394 | 394 |
Instance operating system. |
395 | 395 |
``force_variant`` (bool) |
b/doc/walkthrough.rst | ||
---|---|---|
17 | 17 |
Our simulated, example cluster will have three machines, named |
18 | 18 |
``node1``, ``node2``, ``node3``. Note that in real life machines will |
19 | 19 |
usually FQDNs but here we use short names for brevity. We will use a |
20 |
secondary network for replication data, ``192.168.2.0/24``, with nodes
|
|
20 |
secondary network for replication data, ``192.0.2.0/24``, with nodes
|
|
21 | 21 |
having the last octet the same as their index. The cluster name will be |
22 | 22 |
``example-cluster``. All nodes have the same simulated hardware |
23 | 23 |
configuration, two disks of 750GB, 32GB of memory and 4 CPUs. |
... | ... | |
32 | 32 |
Follow the :doc:`install` document and prepare the nodes. Then it's time |
33 | 33 |
to initialise the cluster:: |
34 | 34 |
|
35 |
node1# gnt-cluster init -s 192.168.2.1 --enabled-hypervisors=xen-pvm cluster
|
|
35 |
node1# gnt-cluster init -s 192.0.2.1 --enabled-hypervisors=xen-pvm example-cluster
|
|
36 | 36 |
node1# |
37 | 37 |
|
38 | 38 |
The creation was fine. Let's check that one node we have is functioning |
... | ... | |
55 | 55 |
|
56 | 56 |
Since this proceeded correctly, let's add the other two nodes:: |
57 | 57 |
|
58 |
node1# gnt-node add -s 192.168.2.2 node2
|
|
58 |
node1# gnt-node add -s 192.0.2.2 node2
|
|
59 | 59 |
-- WARNING -- |
60 | 60 |
Performing this operation is going to replace the ssh daemon keypair |
61 | 61 |
on the target machine (node2) with the ones of the current one |
62 | 62 |
and grant full intra-cluster ssh root access to/from it |
63 | 63 |
|
64 |
The authenticity of host 'node2 (192.168.1.2)' can't be established.
|
|
64 |
The authenticity of host 'node2 (192.0.2.2)' can't be established.
|
|
65 | 65 |
RSA key fingerprint is 9f:… |
66 | 66 |
Are you sure you want to continue connecting (yes/no)? yes |
67 | 67 |
root@node2's password: |
68 | 68 |
Mon Oct 26 02:11:54 2009 - INFO: Node will be a master candidate |
69 |
node1# gnt-node add -s 192.168.2.3 node3
|
|
69 |
node1# gnt-node add -s 192.0.2.3 node3
|
|
70 | 70 |
-- WARNING -- |
71 | 71 |
Performing this operation is going to replace the ssh daemon keypair |
72 | 72 |
on the target machine (node2) with the ones of the current one |
73 | 73 |
and grant full intra-cluster ssh root access to/from it |
74 | 74 |
|
75 |
The authenticity of host 'node3 (192.168.1.3)' can't be established.
|
|
75 |
The authenticity of host 'node3 (192.0.2.3)' can't be established.
|
|
76 | 76 |
RSA key fingerprint is 9f:… |
77 | 77 |
Are you sure you want to continue connecting (yes/no)? yes |
78 | 78 |
root@node2's password: |
... | ... | |
378 | 378 |
|
379 | 379 |
node1# gnt-node info node3 |
380 | 380 |
Node name: node3 |
381 |
primary ip: 172.24.227.1
|
|
382 |
secondary ip: 192.168.2.3
|
|
381 |
primary ip: 198.51.100.1
|
|
382 |
secondary ip: 192.0.2.3
|
|
383 | 383 |
master candidate: True |
384 | 384 |
drained: False |
385 | 385 |
offline: False |
... | ... | |
578 | 578 |
reused. Re-adding it is simple:: |
579 | 579 |
|
580 | 580 |
node1# gnt-node add --readd node3 |
581 |
The authenticity of host 'node3 (172.24.227.1)' can't be established.
|
|
581 |
The authenticity of host 'node3 (198.51.100.1)' can't be established.
|
|
582 | 582 |
RSA key fingerprint is 9f:2e:5a:2e:e0:bd:00:09:e4:5c:32:f2:27:57:7a:f4. |
583 | 583 |
Are you sure you want to continue connecting (yes/no)? yes |
584 | 584 |
Mon Oct 26 05:27:39 2009 - INFO: Readding a node, the offline/drained flags were reset |
b/lib/cmdlib.py | ||
---|---|---|
379 | 379 |
# Acquire all nodes and one instance |
380 | 380 |
self.needed_locks = { |
381 | 381 |
locking.LEVEL_NODE: locking.ALL_SET, |
382 |
locking.LEVEL_INSTANCE: ['instance1.example.tld'],
|
|
382 |
locking.LEVEL_INSTANCE: ['instance1.example.com'],
|
|
383 | 383 |
} |
384 | 384 |
# Acquire just two nodes |
385 | 385 |
self.needed_locks = { |
386 |
locking.LEVEL_NODE: ['node1.example.tld', 'node2.example.tld'],
|
|
386 |
locking.LEVEL_NODE: ['node1.example.com', 'node2.example.com'],
|
|
387 | 387 |
} |
388 | 388 |
# Acquire no locks |
389 | 389 |
self.needed_locks = {} # No, you can't leave it to the default value None |
b/man/gnt-node.sgml | ||
---|---|---|
107 | 107 |
Example: |
108 | 108 |
<screen> |
109 | 109 |
# gnt-node add node5.example.com |
110 |
# gnt-node add -s 192.168.44.5 node5.example.com
|
|
110 |
# gnt-node add -s 192.0.2.5 node5.example.com
|
|
111 | 111 |
</screen> |
112 | 112 |
</para> |
113 | 113 |
</refsect2> |
b/qa/qa-sample.json | ||
---|---|---|
14 | 14 |
{ |
15 | 15 |
"# Master node": null, |
16 | 16 |
"primary": "xen-test-0", |
17 |
"secondary": "192.168.1.1"
|
|
17 |
"secondary": "192.0.2.1"
|
|
18 | 18 |
}, |
19 | 19 |
|
20 | 20 |
{ |
21 | 21 |
"primary": "xen-test-1", |
22 |
"secondary": "192.168.1.2"
|
|
22 |
"secondary": "192.0.2.2"
|
|
23 | 23 |
} |
24 | 24 |
], |
25 | 25 |
|
b/test/data/bdev-drbd-8.0.txt | ||
---|---|---|
28 | 28 |
device "/dev/drbd63"; |
29 | 29 |
disk "/dev/xenvg/test.data"; |
30 | 30 |
meta-disk "/dev/xenvg/test.meta" [ 0 ]; |
31 |
address 192.168.1.1:11000;
|
|
31 |
address 192.0.2.1:11000;
|
|
32 | 32 |
} |
33 | 33 |
_remote_host { |
34 |
address 192.168.1.2:11000;
|
|
34 |
address 192.0.2.2:11000;
|
|
35 | 35 |
} |
b/test/data/bdev-drbd-8.3.txt | ||
---|---|---|
29 | 29 |
device minor 0; |
30 | 30 |
disk "/dev/xenvg/test.data"; |
31 | 31 |
meta-disk "/dev/xenvg/test.meta" [ 0 ]; |
32 |
address ipv4 192.168.1.1:11000;
|
|
32 |
address ipv4 192.0.2.1:11000;
|
|
33 | 33 |
} |
34 | 34 |
_remote_host { |
35 |
address ipv4 192.168.1.2:11000;
|
|
35 |
address ipv4 192.0.2.2:11000;
|
|
36 | 36 |
} |
b/test/data/bdev-drbd-net-ip4.txt | ||
---|---|---|
21 | 21 |
protocol C; |
22 | 22 |
_this_host { |
23 | 23 |
device "/dev/drbd59"; |
24 |
address 192.168.1.1:11002;
|
|
24 |
address 192.0.2.1:11002;
|
|
25 | 25 |
} |
26 | 26 |
_remote_host { |
27 |
address 192.168.1.2:11002;
|
|
27 |
address 192.0.2.2:11002;
|
|
28 | 28 |
} |
b/test/ganeti.backend_unittest.py | ||
---|---|---|
82 | 82 |
|
83 | 83 |
def testMasterIPUnreachable(self): |
84 | 84 |
# Network 192.0.2.0/24 is reserved for test/documentation as per |
85 |
# RFC 5735
|
|
85 |
# RFC 5737
|
|
86 | 86 |
bad_data = ("master.example.com", "192.0.2.1") |
87 | 87 |
# we just test that whatever TcpPing returns, VerifyNode returns too |
88 | 88 |
netutils.TcpPing = lambda a, b, source=None: False |
b/test/ganeti.bdev_unittest.py | ||
---|---|---|
69 | 69 |
self.failUnless(self._has_disk(result, "/dev/xenvg/test.data", |
70 | 70 |
"/dev/xenvg/test.meta"), |
71 | 71 |
"Wrong local disk info") |
72 |
self.failUnless(self._has_net(result, ("192.168.1.1", 11000),
|
|
73 |
("192.168.1.2", 11000)),
|
|
72 |
self.failUnless(self._has_net(result, ("192.0.2.1", 11000),
|
|
73 |
("192.0.2.2", 11000)),
|
|
74 | 74 |
"Wrong network info (8.0.x)") |
75 | 75 |
|
76 | 76 |
def testParser83(self): |
... | ... | |
80 | 80 |
self.failUnless(self._has_disk(result, "/dev/xenvg/test.data", |
81 | 81 |
"/dev/xenvg/test.meta"), |
82 | 82 |
"Wrong local disk info") |
83 |
self.failUnless(self._has_net(result, ("192.168.1.1", 11000),
|
|
84 |
("192.168.1.2", 11000)),
|
|
83 |
self.failUnless(self._has_net(result, ("192.0.2.1", 11000),
|
|
84 |
("192.0.2.2", 11000)),
|
|
85 | 85 |
"Wrong network info (8.0.x)") |
86 | 86 |
|
87 | 87 |
def testParserNetIP4(self): |
... | ... | |
92 | 92 |
"meta_dev" not in result and |
93 | 93 |
"meta_index" not in result), |
94 | 94 |
"Should not find local disk info") |
95 |
self.failUnless(self._has_net(result, ("192.168.1.1", 11002),
|
|
96 |
("192.168.1.2", 11002)),
|
|
95 |
self.failUnless(self._has_net(result, ("192.0.2.1", 11002),
|
|
96 |
("192.0.2.2", 11002)),
|
|
97 | 97 |
"Wrong network info (IPv4)") |
98 | 98 |
|
99 | 99 |
def testParserNetIP6(self): |
b/test/ganeti.confd.client_unittest.py | ||
---|---|---|
182 | 182 |
def testSetPeersFamily(self): |
183 | 183 |
self.client._SetPeersAddressFamily() |
184 | 184 |
self.assertEquals(self.client._family, self.family) |
185 |
mixed_peers = ["1.2.3.6", "2001:db8:beef::13"]
|
|
185 |
mixed_peers = ["192.0.2.99", "2001:db8:beef::13"]
|
|
186 | 186 |
self.client.UpdatePeerList(mixed_peers) |
187 | 187 |
self.assertRaises(errors.ConfdClientError, |
188 | 188 |
self.client._SetPeersAddressFamily) |
... | ... | |
190 | 190 |
|
191 | 191 |
class TestIP4Client(unittest.TestCase, _BaseClientTest): |
192 | 192 |
"""Client tests""" |
193 |
mc_list = ["10.0.0.1",
|
|
194 |
"10.0.0.2",
|
|
195 |
"10.0.0.3",
|
|
196 |
"10.0.0.4",
|
|
197 |
"10.0.0.5",
|
|
198 |
"10.0.0.6",
|
|
199 |
"10.0.0.7",
|
|
200 |
"10.0.0.8",
|
|
201 |
"10.0.0.9",
|
|
193 |
mc_list = ["192.0.2.1",
|
|
194 |
"192.0.2.2",
|
|
195 |
"192.0.2.3",
|
|
196 |
"192.0.2.4",
|
|
197 |
"192.0.2.5",
|
|
198 |
"192.0.2.6",
|
|
199 |
"192.0.2.7",
|
|
200 |
"192.0.2.8",
|
|
201 |
"192.0.2.9",
|
|
202 | 202 |
] |
203 |
new_peers = ["1.2.3.4", "1.2.3.5"]
|
|
203 |
new_peers = ["198.51.100.1", "198.51.100.2"]
|
|
204 | 204 |
family = socket.AF_INET |
205 | 205 |
|
206 | 206 |
def setUp(self): |
b/test/ganeti.impexpd_unittest.py | ||
---|---|---|
81 | 81 |
else: |
82 | 82 |
self.assertFalse(magic_cmd) |
83 | 83 |
|
84 |
for host in ["localhost", "1.2.3.4", "192.0.2.99"]:
|
|
84 |
for host in ["localhost", "198.51.100.4", "192.0.2.99"]:
|
|
85 | 85 |
for port in [0, 1, 1234, 7856, 45452]: |
86 | 86 |
for cmd_prefix in [None, "PrefixCommandGoesHere|", |
87 | 87 |
"dd if=/dev/hda bs=1048576 |"]: |
b/test/ganeti.netutils_unittest.py | ||
---|---|---|
335 | 335 |
"""check that I don't own an address""" |
336 | 336 |
|
337 | 337 |
# Network 192.0.2.0/24 is reserved for test/documentation as per |
338 |
# RFC 5735, so we *should* not have an address of this range... if
|
|
338 |
# RFC 5737, so we *should* not have an address of this range... if
|
|
339 | 339 |
# this fails, we should extend the test to multiple addresses |
340 | 340 |
DST_IP = "192.0.2.1" |
341 | 341 |
self.failIf(netutils.OwnIpAddress(DST_IP), |
b/test/ganeti.rapi.rlib2_unittest.py | ||
---|---|---|
67 | 67 |
|
68 | 68 |
# Two NICs |
69 | 69 |
[ |
70 |
{ "ip": "1.2.3.4", "mode": constants.NIC_MODE_ROUTED, },
|
|
70 |
{ "ip": "192.0.2.6", "mode": constants.NIC_MODE_ROUTED, },
|
|
71 | 71 |
{ "mode": constants.NIC_MODE_BRIDGED, "link": "n0", "bridge": "br1", }, |
72 | 72 |
], |
73 | 73 |
|
b/test/ganeti.utils_unittest.py | ||
---|---|---|
999 | 999 |
"""Test case for the AddAuthorizedKey function""" |
1000 | 1000 |
|
1001 | 1001 |
KEY_A = 'ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a' |
1002 |
KEY_B = ('command="/usr/bin/fooserver -t --verbose",from="1.2.3.4" '
|
|
1002 |
KEY_B = ('command="/usr/bin/fooserver -t --verbose",from="198.51.100.4" '
|
|
1003 | 1003 |
'ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b') |
1004 | 1004 |
|
1005 | 1005 |
def setUp(self): |
... | ... | |
1018 | 1018 |
|
1019 | 1019 |
self.assertFileContent(self.tmpname, |
1020 | 1020 |
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n" |
1021 |
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
|
|
1021 |
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
|
|
1022 | 1022 |
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n" |
1023 | 1023 |
"ssh-dss AAAAB3NzaC1kc3MAAACB root@test\n") |
1024 | 1024 |
|
... | ... | |
1028 | 1028 |
|
1029 | 1029 |
self.assertFileContent(self.tmpname, |
1030 | 1030 |
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n" |
1031 |
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
|
|
1031 |
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
|
|
1032 | 1032 |
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n" |
1033 | 1033 |
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@test\n") |
1034 | 1034 |
|
... | ... | |
1038 | 1038 |
|
1039 | 1039 |
self.assertFileContent(self.tmpname, |
1040 | 1040 |
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n" |
1041 |
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
|
|
1041 |
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
|
|
1042 | 1042 |
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n") |
1043 | 1043 |
|
1044 | 1044 |
def testRemovingExistingKeyWithSomeMoreSpaces(self): |
... | ... | |
1046 | 1046 |
'ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a') |
1047 | 1047 |
|
1048 | 1048 |
self.assertFileContent(self.tmpname, |
1049 |
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
|
|
1049 |
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
|
|
1050 | 1050 |
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n") |
1051 | 1051 |
|
1052 | 1052 |
def testRemovingNonExistingKey(self): |
... | ... | |
1055 | 1055 |
|
1056 | 1056 |
self.assertFileContent(self.tmpname, |
1057 | 1057 |
"ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a\n" |
1058 |
'command="/usr/bin/fooserver -t --verbose",from="1.2.3.4"'
|
|
1058 |
'command="/usr/bin/fooserver -t --verbose",from="198.51.100.4"'
|
|
1059 | 1059 |
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n") |
1060 | 1060 |
|
1061 | 1061 |
|
... | ... | |
1069 | 1069 |
try: |
1070 | 1070 |
handle.write('# This is a test file for /etc/hosts\n') |
1071 | 1071 |
handle.write('127.0.0.1\tlocalhost\n') |
1072 |
handle.write('192.168.1.1 router gw\n')
|
|
1072 |
handle.write('192.0.2.1 router gw\n')
|
|
1073 | 1073 |
finally: |
1074 | 1074 |
handle.close() |
1075 | 1075 |
|
1076 | 1076 |
def testSettingNewIp(self): |
1077 |
SetEtcHostsEntry(self.tmpname, '1.2.3.4', 'myhost.domain.tld', ['myhost']) |
|
1077 |
SetEtcHostsEntry(self.tmpname, '198.51.100.4', 'myhost.example.com', |
|
1078 |
['myhost']) |
|
1078 | 1079 |
|
1079 | 1080 |
self.assertFileContent(self.tmpname, |
1080 | 1081 |
"# This is a test file for /etc/hosts\n" |
1081 | 1082 |
"127.0.0.1\tlocalhost\n" |
1082 |
"192.168.1.1 router gw\n"
|
|
1083 |
"1.2.3.4\tmyhost.domain.tld myhost\n")
|
|
1083 |
"192.0.2.1 router gw\n"
|
|
1084 |
"198.51.100.4\tmyhost.example.com myhost\n")
|
|
1084 | 1085 |
self.assertFileMode(self.tmpname, 0644) |
1085 | 1086 |
|
1086 | 1087 |
def testSettingExistingIp(self): |
1087 |
SetEtcHostsEntry(self.tmpname, '192.168.1.1', 'myhost.domain.tld',
|
|
1088 |
SetEtcHostsEntry(self.tmpname, '192.0.2.1', 'myhost.example.com',
|
|
1088 | 1089 |
['myhost']) |
1089 | 1090 |
|
1090 | 1091 |
self.assertFileContent(self.tmpname, |
1091 | 1092 |
"# This is a test file for /etc/hosts\n" |
1092 | 1093 |
"127.0.0.1\tlocalhost\n" |
1093 |
"192.168.1.1\tmyhost.domain.tld myhost\n")
|
|
1094 |
"192.0.2.1\tmyhost.example.com myhost\n")
|
|
1094 | 1095 |
self.assertFileMode(self.tmpname, 0644) |
1095 | 1096 |
|
1096 | 1097 |
def testSettingDuplicateName(self): |
1097 |
SetEtcHostsEntry(self.tmpname, '1.2.3.4', 'myhost', ['myhost'])
|
|
1098 |
SetEtcHostsEntry(self.tmpname, '198.51.100.4', 'myhost', ['myhost'])
|
|
1098 | 1099 |
|
1099 | 1100 |
self.assertFileContent(self.tmpname, |
1100 | 1101 |
"# This is a test file for /etc/hosts\n" |
1101 | 1102 |
"127.0.0.1\tlocalhost\n" |
1102 |
"192.168.1.1 router gw\n"
|
|
1103 |
"1.2.3.4\tmyhost\n")
|
|
1103 |
"192.0.2.1 router gw\n"
|
|
1104 |
"198.51.100.4\tmyhost\n")
|
|
1104 | 1105 |
self.assertFileMode(self.tmpname, 0644) |
1105 | 1106 |
|
1106 | 1107 |
def testRemovingExistingHost(self): |
... | ... | |
1109 | 1110 |
self.assertFileContent(self.tmpname, |
1110 | 1111 |
"# This is a test file for /etc/hosts\n" |
1111 | 1112 |
"127.0.0.1\tlocalhost\n" |
1112 |
"192.168.1.1 gw\n")
|
|
1113 |
"192.0.2.1 gw\n")
|
|
1113 | 1114 |
self.assertFileMode(self.tmpname, 0644) |
1114 | 1115 |
|
1115 | 1116 |
def testRemovingSingleExistingHost(self): |
... | ... | |
1117 | 1118 |
|
1118 | 1119 |
self.assertFileContent(self.tmpname, |
1119 | 1120 |
"# This is a test file for /etc/hosts\n" |
1120 |
"192.168.1.1 router gw\n")
|
|
1121 |
"192.0.2.1 router gw\n")
|
|
1121 | 1122 |
self.assertFileMode(self.tmpname, 0644) |
1122 | 1123 |
|
1123 | 1124 |
def testRemovingNonExistingHost(self): |
... | ... | |
1126 | 1127 |
self.assertFileContent(self.tmpname, |
1127 | 1128 |
"# This is a test file for /etc/hosts\n" |
1128 | 1129 |
"127.0.0.1\tlocalhost\n" |
1129 |
"192.168.1.1 router gw\n")
|
|
1130 |
"192.0.2.1 router gw\n")
|
|
1130 | 1131 |
self.assertFileMode(self.tmpname, 0644) |
1131 | 1132 |
|
1132 | 1133 |
def testRemovingAlias(self): |
... | ... | |
1135 | 1136 |
self.assertFileContent(self.tmpname, |
1136 | 1137 |
"# This is a test file for /etc/hosts\n" |
1137 | 1138 |
"127.0.0.1\tlocalhost\n" |
1138 |
"192.168.1.1 router\n")
|
|
1139 |
"192.0.2.1 router\n")
|
|
1139 | 1140 |
self.assertFileMode(self.tmpname, 0644) |
1140 | 1141 |
|
1141 | 1142 |
|
Also available in: Unified diff