~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/virt/libvirt/vif.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2013-08-09 10:12:27 UTC
  • mfrom: (1.1.74)
  • Revision ID: package-import@ubuntu.com-20130809101227-4n60fzcgra8dzk3d
Tags: 1:2013.1.3-0ubuntu1
* Resynchronize with stable/grizzly (89c7ee4) (LP: #1210447):
  - [8e6edd2] Bump stable/grizzly next version to 2013.1.3
  - [61fc529] attach quantum security group to an existing vm failed
    LP: 1189059
  - [60774bd] nova-compute fails to start if quantum is down LP: 1186357
  - [8e6d4b6] asymmetric routes in nova network with external gateway and
    routing_source_ip LP: 1182143
  - [8849413] Failed VM's not set to error state on exception LP: 1182056
  - [ef10eee] Double healing of info_cache with cells LP: 1180304
  - [7422d83] Can't log into  VM after powervm is resized LP: 1169848
  - [49ab0e8] stack trace when instance_actions extension can not find
    instance in GET LP: 1182867
  - [e71247c] nova service-list returns illegal result with non db service
    heartbeat LP: 1168861
  - [3f60606] Volume IO usage gets reset to 0 after a reboot / crash
    LP: 1169097
  - [19c443b] unused method  list_interfaces in vmware driver can be removed
    LP: 1187251
  - [a8dab9f] No cleanup done when file transfer fails with powervm driver
    LP: 1173017
  - [fc98015] nova consoleauth depends on Conductor Service LP: 1186123
  - [1066418] VMware drivers are no longer passing quantum port-id to
    vCenter LP: 1183452
  - [b92075c] nova net-list fails on empty list with Quantum backend
    LP: 1189976
  - [3ba31f2] Create VM with no networks with Quantum Gives SecurityGroups
    Exception LP: 1191044
  - [89150b2] Periodic ValueErrors when using qpid LP: 1185465
  - [0e0d615] Libvirt pre-Grizzly instances cannot be block migrated
    LP: 1185588
  - [27960ef] ZMQ ipc socket file is created using un-sanitized network
    input LP: 1122763
  - [265b868] cannot block migrate old style instances libvirt complains
    LP: 1175286
  - [008a68a] code logical error exists in vmwareapi vif.py  LP: 1177635
  - [378c045] Instance IP addresses are re-used even when previous instance
    could not be powered off LP: 1180178
  - [48ddffe] Reboot of compute node breaks VMs with volumes LP: 1188326
  - [f427f01] Missing dashes from console-log LP: 1194032
  - [78ebf1a] network-create returns an internal error when network
    conflicts LP: 1158075
  - [767c850] Instance nics are reorder after reboot LP: 1187092
  - [0b45996] instance directory naming update to use uuid  LP: 1186944
  - [06cfad5] Disassociate failed dhcp fixed ip in deallocate_for_instance()
    method LP: 1180766
  - [cbcdfc5] Allow confirm_resize action on an instance in 'deleting'
    status LP: 1189391
  - [2563c44] aggregate_get_by_host returns aggregates from other hosts
    LP: 1201277
  - [109f3a9] nova libvirt driver requires iscsi initiator name regardless
    of using it in volume drivers LP: 1007084
  - [7f1c336] Host is always set to None in get_instance_nw_info(...)
    LP: 1194178
  - [1cf30a3] nova boot with colume should fail if the volume is already
    attached to another instance LP: 1166770
  - [9cb9361] Aggregate metadata filtering by key returns unrelated metadata
    LP: 1201283
  - [a61872b] Need clean up  ftp transfer faiure  in powervm driver
    LP: 1188884
  - [91bcd15] Race can cause soft deleted instance to be erased by mistake
    LP: 1186243
  - [c57fded] Nova fails to create a security group rule if ::0/0 is used as
    cidr LP: 1199943
  - [c698dd3] VMwareESXDriver and VMwareVCDriver report incorrect stat
    LP: 1180779
  - [e572faf] novnc fails when amqp_rpc_single_reply_queue=True LP: 1193031
  - [34ddd27] eventlet.monkey_patch() for spice and vnc proxy
  - [864837f] hypervisor_hostname not updated on evacuate LP: 1198284
  - [756a772] libvirt migrate/resize on shared storage can cause data loss
    LP: 1177247
  - [889b215] nova live-migration of volume-backed VM fails because of image
    is None LP: 1199811
  - [60712a4] VNC console does not work with VCDriver LP: 1178369
  - [e0aa0f5] metadata service throws error 500 when compute_driver is not
    set LP: 1184641
  - [340d337] Instance IP addresses are re-used even when previous instance
    could not be powered off LP: 1180178
  - [8247dc8] Resource limit circumvention in Nova private flavors
    (CVE-2013-2256) LP: 1194093
  - [bd7e467] Denial of Service in Nova network source security groups
    (CVE-2013-4185) LP: 1184041
  - [c3fddb7] Resize a VM when a volume is attached fails LP: 1190364
  - [01edbaa] Hyper-V versions before 2012 are not properly recognized
    LP: 1203059
  - [b18818a] driver libvirt doesn't honor vif quota LP: 1185030
  - [798984d] config drive not visible to windows LP: 1155842
  - [d18ceb1] nova live-migration failed due to exception.MigrationError
    LP: 1171526
  - [1934dbc] vmware Hyper for nova vnc console url parameters error
    LP: 1172177
  - [89c7ee4] [OSSA 2013-023] Potential unsafe XML usage (CVE-2013-4179,
    CVE-2013-4202) LP: 1190229
* debian/rules: Clean new setuptools-git cruft.
* debian/control: Update Vcs fields.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
            return mapping['vif_devname']
93
93
        return ("nic" + mapping['vif_uuid'])[:network_model.NIC_NAME_LEN]
94
94
 
95
 
    def get_config(self, instance, network, mapping, image_meta):
 
95
    def get_config(self, instance, network, mapping, image_meta, inst_type):
96
96
        conf = vconfig.LibvirtConfigGuestInterface()
97
97
        # Default to letting libvirt / the hypervisor choose the model
98
98
        model = None
159
159
            return True
160
160
        return False
161
161
 
162
 
    def get_config_bridge(self, instance, network, mapping, image_meta):
 
162
    def get_config_bridge(self, instance, network, mapping, image_meta,
 
163
                          inst_type):
163
164
        """Get VIF configurations for bridge type."""
164
165
        conf = super(LibvirtGenericVIFDriver,
165
166
                     self).get_config(instance,
166
167
                                      network,
167
168
                                      mapping,
168
 
                                      image_meta)
 
169
                                      image_meta, inst_type)
169
170
 
170
171
        designer.set_vif_host_backend_bridge_config(
171
172
            conf, self.get_bridge_name(network),
175
176
        name = "nova-instance-" + instance['name'] + "-" + mac_id
176
177
        if self.get_firewall_required():
177
178
            conf.filtername = name
178
 
        designer.set_vif_bandwidth_config(conf, instance)
 
179
        designer.set_vif_bandwidth_config(conf, inst_type)
179
180
 
180
181
        return conf
181
182
 
182
 
    def get_config_ovs_ethernet(self, instance, network, mapping, image_meta):
 
183
    def get_config_ovs_ethernet(self, instance, network, mapping,
 
184
                                image_meta, inst_type):
183
185
        conf = super(LibvirtGenericVIFDriver,
184
186
                     self).get_config(instance,
185
187
                                      network,
186
188
                                      mapping,
187
 
                                      image_meta)
 
189
                                      image_meta, inst_type)
188
190
 
189
191
        dev = self.get_vif_devname(mapping)
190
192
        designer.set_vif_host_backend_ethernet_config(conf, dev)
191
193
 
192
194
        return conf
193
195
 
194
 
    def get_config_ovs_bridge(self, instance, network, mapping, image_meta):
 
196
    def get_config_ovs_bridge(self, instance, network, mapping, image_meta,
 
197
                              inst_type):
195
198
        conf = super(LibvirtGenericVIFDriver,
196
199
                     self).get_config(instance,
197
200
                                      network,
198
201
                                      mapping,
199
 
                                      image_meta)
 
202
                                      image_meta, inst_type)
200
203
 
201
204
        designer.set_vif_host_backend_ovs_config(
202
205
            conf, self.get_bridge_name(network),
205
208
 
206
209
        return conf
207
210
 
208
 
    def get_config_ovs_hybrid(self, instance, network, mapping, image_meta):
 
211
    def get_config_ovs_hybrid(self, instance, network, mapping, image_meta,
 
212
                              inst_type):
209
213
        newnet = copy.deepcopy(network)
210
214
        newnet['bridge'] = self.get_br_name(mapping['vif_uuid'])
211
215
        return self.get_config_bridge(instance,
212
216
                                      newnet,
213
217
                                      mapping,
214
 
                                      image_meta)
 
218
                                      image_meta, inst_type)
215
219
 
216
 
    def get_config_ovs(self, instance, network, mapping, image_meta):
 
220
    def get_config_ovs(self, instance, network, mapping, image_meta,
 
221
                       inst_type):
217
222
        if self.get_firewall_required():
218
223
            return self.get_config_ovs_hybrid(instance, network,
219
224
                                              mapping,
220
 
                                              image_meta)
 
225
                                              image_meta,
 
226
                                              inst_type)
221
227
        elif self.has_libvirt_version(LIBVIRT_OVS_VPORT_VERSION):
222
228
            return self.get_config_ovs_bridge(instance, network,
223
229
                                              mapping,
224
 
                                              image_meta)
 
230
                                              image_meta,
 
231
                                              inst_type)
225
232
        else:
226
233
            return self.get_config_ovs_ethernet(instance, network,
227
234
                                                mapping,
228
 
                                                image_meta)
 
235
                                                image_meta,
 
236
                                                inst_type)
229
237
 
230
 
    def get_config_802qbg(self, instance, network, mapping, image_meta):
 
238
    def get_config_802qbg(self, instance, network, mapping, image_meta,
 
239
                          inst_type):
231
240
        conf = super(LibvirtGenericVIFDriver,
232
241
                     self).get_config(instance,
233
242
                                      network,
234
243
                                      mapping,
235
 
                                      image_meta)
 
244
                                      image_meta, inst_type)
236
245
 
237
246
        params = mapping["qbg_params"]
238
247
        designer.set_vif_host_backend_802qbg_config(
244
253
 
245
254
        return conf
246
255
 
247
 
    def get_config_802qbh(self, instance, network, mapping, image_meta):
 
256
    def get_config_802qbh(self, instance, network, mapping, image_meta,
 
257
                          inst_type):
248
258
        conf = super(LibvirtGenericVIFDriver,
249
259
                     self).get_config(instance,
250
260
                                      network,
251
261
                                      mapping,
252
 
                                      image_meta)
 
262
                                      image_meta, inst_type)
253
263
 
254
264
        params = mapping["qbh_params"]
255
265
        designer.set_vif_host_backend_802qbh_config(
258
268
 
259
269
        return conf
260
270
 
261
 
    def get_config(self, instance, network, mapping, image_meta):
 
271
    def get_config(self, instance, network, mapping, image_meta, inst_type):
262
272
        vif_type = mapping.get('vif_type')
263
273
 
264
274
        LOG.debug(_("vif_type=%(vif_type)s instance=%(instance)s "
273
283
        if vif_type == network_model.VIF_TYPE_BRIDGE:
274
284
            return self.get_config_bridge(instance,
275
285
                                          network, mapping,
276
 
                                          image_meta)
 
286
                                          image_meta,
 
287
                                          inst_type)
277
288
        elif vif_type == network_model.VIF_TYPE_OVS:
278
289
            return self.get_config_ovs(instance,
279
290
                                       network, mapping,
280
 
                                       image_meta)
 
291
                                       image_meta,
 
292
                                       inst_type)
281
293
        elif vif_type == network_model.VIF_TYPE_802_QBG:
282
294
            return self.get_config_802qbg(instance,
283
295
                                          network, mapping,
284
 
                                          image_meta)
 
296
                                          image_meta,
 
297
                                          inst_type)
285
298
        elif vif_type == network_model.VIF_TYPE_802_QBH:
286
299
            return self.get_config_802qbh(instance,
287
300
                                          network, mapping,
288
 
                                          image_meta)
 
301
                                          image_meta,
 
302
                                          inst_type)
289
303
        else:
290
304
            raise exception.NovaException(
291
305
                _("Unexpected vif_type=%s") % vif_type)
496
510
       drivers which do not yet report 'vif_type' port binding.
497
511
       Will be deprecated in Havana, and removed in Ixxxx."""
498
512
 
499
 
    def get_config(self, instance, network, mapping, image_meta):
500
 
        return self.get_config_bridge(instance, network, mapping, image_meta)
 
513
    def get_config(self, instance, network, mapping, image_meta, inst_type):
 
514
        return self.get_config_bridge(instance, network, mapping, image_meta,
 
515
                                      inst_type)
501
516
 
502
517
    def plug(self, instance, vif):
503
518
        self.plug_bridge(instance, vif)
517
532
    def get_ovs_interfaceid(self, mapping):
518
533
        return mapping.get('ovs_interfaceid') or mapping['vif_uuid']
519
534
 
520
 
    def get_config(self, instance, network, mapping, image_meta):
 
535
    def get_config(self, instance, network, mapping, image_meta, inst_type):
521
536
        return self.get_config_ovs_ethernet(instance,
522
537
                                            network, mapping,
523
 
                                            image_meta)
 
538
                                            image_meta, inst_type)
524
539
 
525
540
    def plug(self, instance, vif):
526
541
        self.plug_ovs_ethernet(instance, vif)
540
555
    def get_ovs_interfaceid(self, mapping):
541
556
        return mapping.get('ovs_interfaceid') or mapping['vif_uuid']
542
557
 
543
 
    def get_config(self, instance, network, mapping, image_meta):
 
558
    def get_config(self, instance, network, mapping, image_meta, inst_type):
544
559
        return self.get_config_ovs_hybrid(instance,
545
560
                                          network, mapping,
546
 
                                          image_meta)
 
561
                                          image_meta,
 
562
                                          inst_type)
547
563
 
548
564
    def plug(self, instance, vif):
549
565
        return self.plug_ovs_hybrid(instance, vif)
563
579
    def get_ovs_interfaceid(self, mapping):
564
580
        return mapping.get('ovs_interfaceid') or mapping['vif_uuid']
565
581
 
566
 
    def get_config(self, instance, network, mapping, image_meta):
 
582
    def get_config(self, instance, network, mapping, image_meta, inst_type):
567
583
        return self.get_config_ovs_bridge(instance,
568
584
                                          network, mapping,
569
 
                                          image_meta)
 
585
                                          image_meta,
 
586
                                          inst_type)
570
587
 
571
588
    def plug(self, instance, vif):
572
589
        return self.plug_ovs_bridge(instance, vif)
584
601
        def_bridge = ("brq" + network['id'])[:network_model.NIC_NAME_LEN]
585
602
        return network.get('bridge') or def_bridge
586
603
 
587
 
    def get_config(self, instance, network, mapping, image_meta):
 
604
    def get_config(self, instance, network, mapping, image_meta, inst_type):
588
605
        # In order for libvirt to make use of the bridge name then it has
589
606
        # to ensure that the bridge exists
590
607
        if 'should_create_bridge' not in mapping:
591
608
            mapping['should_create_bridge'] = True
592
 
        return self.get_config_bridge(instance, network, mapping, image_meta)
 
609
        return self.get_config_bridge(instance, network, mapping, image_meta,
 
610
                                      inst_type)
593
611
 
594
612
    def plug(self, instance, vif):
595
613
        self.plug_bridge(instance, vif)