Ubuntu Pastebin

Paste from smoser at Fri, 22 Jul 2016 01:37:14 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
=== modified file 'cloudinit/net/network_state.py'
--- cloudinit/net/network_state.py	2016-06-14 17:58:18 +0000
+++ cloudinit/net/network_state.py	2016-07-21 20:03:34 +0000
@@ -308,6 +308,7 @@
          bond-lacp-rate 4
         '''
 
+        print("command=%s" % command)
         self.handle_physical(command)
         interfaces = self._network_state.get('interfaces')
         iface = interfaces.get(command.get('name'), {})

=== modified file 'tests/unittests/test_datasource/test_configdrive.py'
--- tests/unittests/test_datasource/test_configdrive.py	2016-06-10 21:16:51 +0000
+++ tests/unittests/test_datasource/test_configdrive.py	2016-07-22 01:35:16 +0000
@@ -101,6 +101,93 @@
          "type": "vif", "id": "eth1", "vif_id": "vif-foo2"}]
 }
 
+NETWORK_DATA_3 = {
+  "services": [
+    {
+      "type": "dns",
+      "address": "1.1.1.191"
+    },
+    {
+      "type": "dns",
+      "address": "1.1.1.4"
+    }
+  ],
+  "networks": [
+    {
+      "network_id": "4daf5ce8-38cf-4240-9f1a-04e86d7c6117",
+      "type": "ipv4",
+      "netmask": "255.255.255.248",
+      "link": "vlan2",
+      "routes": [
+        {
+          "netmask": "0.0.0.0",
+          "network": "0.0.0.0",
+          "gateway": "2.2.2.9"
+        }
+      ],
+      "ip_address": "2.2.2.13",
+      "id": "network2-ipv4"
+    },
+    {
+      "network_id": "a9e2f47c-3c43-4782-94d0-e1eeef1c8c9d",
+      "type": "ipv4",
+      "netmask": "255.255.255.248",
+      "link": "vlan3",
+      "routes": [
+        {
+          "netmask": "255.255.255.255",
+          "network": "192.168.1.0",
+          "gateway": "10.0.1.1"
+        }
+      ],
+      "ip_address": "10.0.1.5",
+      "id": "network3-ipv4"
+    }
+  ],
+  "links": [
+    {
+      "ethernet_mac_address": "0c:c4:7a:34:6e:3c",
+      "type": "phy",
+      "id": "eth0",
+      "mtu": 1500
+    },
+    {
+      "ethernet_mac_address": "0c:c4:7a:34:6e:3d",
+      "type": "phy",
+      "id": "eth1",
+      "mtu": 1500
+    },
+    {
+      "bond_mode": "4",
+      "bond_miimon": 100,
+      "type": "bond",
+      "bond_links": [
+        "eth0",
+        "eth1"
+      ],
+      "ethernet_mac_address": "0c:c4:7a:34:6e:3c",
+      "id": "bond0",
+      "bond_xmit_hash_policy": "layer3+4"
+    },
+    {
+      "ethernet_mac_address": "fa:16:3e:b3:72:30",
+      "vlan_link": "bond0",
+      "vlan_id": 602,
+      "type": "vlan",
+      "id": "vlan2",
+      "vlan_mac_address": "fa:16:3e:b3:72:30"
+    },
+    {
+      "ethernet_mac_address": "fa:16:3e:66:ab:a6",
+      "vlan_link": "bond0",
+      "vlan_id": 612,
+      "type": "vlan",
+      "id": "vlan3",
+      "vlan_mac_address": "fa:16:3e:66:ab:a6"
+    }
+  ]
+}
+
 
 KNOWN_MACS = {
     'fa:16:3e:69:b0:58': 'enp0s1',
@@ -108,6 +195,8 @@
     'fa:16:3e:dd:50:9a': 'foo1',
     'fa:16:3e:a8:14:69': 'foo2',
     'fa:16:3e:ed:9a:59': 'foo3',
+    '0c:c4:7a:34:6e:3d': 'oeth1',
+    '0c:c4:7a:34:6e:3c': 'oeth0',
 }
 
 CFG_DRIVE_FILES_V2 = {
@@ -555,6 +644,17 @@
             eni_rendering = f.read()
             self.assertIn("route add default gw 2.2.2.9", eni_rendering)
 
+    def test_bond_conversion(self):
+        ncfg = openstack.convert_net_json(NETWORK_DATA_3,
+                                          known_macs=KNOWN_MACS)
+        eni_renderer = eni.Renderer()
+        eni_renderer.render_network_state(
+            self.tmp, network_state.parse_net_config_data(ncfg))
+        with open(os.path.join(self.tmp, "etc",
+                               "network", "interfaces"), 'r') as f:
+            eni_rendering = f.read()
+        raise Exception("foo")
+
 
 def cfg_ds_from_dir(seed_d):
     cfg_ds = ds.DataSourceConfigDrive(settings.CFG_BUILTIN, None,
Download as text