~mdragon/nova/system-usages

« back to all changes in this revision

Viewing changes to nova/network/vmwareapi_net.py

  • Committer: Monsyne Dragon
  • Date: 2011-06-28 10:23:00 UTC
  • mfrom: (1077.1.141 nova)
  • Revision ID: mdragon@rackspace.com-20110628102300-lnkdr13k8uuyp30i
remergedĀ trunkĀ 

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    License for the specific language governing permissions and limitations
16
16
#    under the License.
17
17
 
18
 
"""
19
 
Implements vlans for vmwareapi.
20
 
"""
 
18
"""Implements vlans for vmwareapi."""
21
19
 
22
20
from nova import db
23
21
from nova import exception
27
25
from nova.virt.vmwareapi_conn import VMWareAPISession
28
26
from nova.virt.vmwareapi import network_utils
29
27
 
 
28
 
30
29
LOG = logging.getLogger("nova.network.vmwareapi_net")
31
30
 
 
31
 
32
32
FLAGS = flags.FLAGS
33
 
flags.DEFINE_string('vlan_interface', 'vmnic0',
34
 
                    'Physical network adapter name in VMware ESX host for '
35
 
                    'vlan networking')
 
33
FLAGS['vlan_interface'].SetDefault('vmnic0')
36
34
 
37
35
 
38
36
def ensure_vlan_bridge(vlan_num, bridge, net_attrs=None):
42
40
    host_username = FLAGS.vmwareapi_host_username
43
41
    host_password = FLAGS.vmwareapi_host_password
44
42
    if not host_ip or host_username is None or host_password is None:
45
 
        raise Exception(_("Must specify vmwareapi_host_ip,"
46
 
                        "vmwareapi_host_username "
47
 
                        "and vmwareapi_host_password to use"
48
 
                        "connection_type=vmwareapi"))
 
43
        raise Exception(_('Must specify vmwareapi_host_ip, '
 
44
                          'vmwareapi_host_username '
 
45
                          'and vmwareapi_host_password to use '
 
46
                          'connection_type=vmwareapi'))
49
47
    session = VMWareAPISession(host_ip, host_username, host_password,
50
48
                               FLAGS.vmwareapi_api_retry_count)
51
49
    vlan_interface = FLAGS.vlan_interface