components/openstack/neutron/files/neutron-dhcp-agent
changeset 3524 ad6a9e0880b9
parent 1944 56ac2df1785b
child 3998 5bd484384122
equal deleted inserted replaced
3521:958ebf9deed1 3524:ad6a9e0880b9
    60 
    60 
    61         try:
    61         try:
    62             # first remove the IP
    62             # first remove the IP
    63             check_call(["/usr/bin/pfexec", "/usr/sbin/ipadm", "delete-ip",
    63             check_call(["/usr/bin/pfexec", "/usr/sbin/ipadm", "delete-ip",
    64                         ifname])
    64                         ifname])
       
    65             # get the tenant, evs, and vport name for the VNIC
       
    66             cmd = ["/usr/sbin/dladm", "show-vnic", "-po",
       
    67                    "tenant,evs,vport", ifname]
       
    68             p = Popen(cmd, stdout=PIPE, stderr=PIPE)
       
    69             output, error = p.communicate()
       
    70             if p.returncode != 0:
       
    71                 print "failed to retrieve Tenant, EVS," \
       
    72                       " and VPort info for a VNIC"
       
    73                 return smf_include.SMF_EXIT_ERR_FATAL
       
    74             tenant, evs, vport = output.strip().split(':')
    65             # next remove the VNIC
    75             # next remove the VNIC
    66             check_call(["/usr/bin/pfexec", "/usr/sbin/dladm", "delete-vnic",
    76             check_call(["/usr/bin/pfexec", "/usr/sbin/dladm", "delete-vnic",
    67                         ifname])
    77                         ifname])
       
    78             # remove the EVS VPort
       
    79             check_call(["/usr/sbin/evsadm", "remove-vport", "-T", tenant,
       
    80                         "%s/%s" % (evs, vport)])
    68         except CalledProcessError as err:
    81         except CalledProcessError as err:
    69             print "failed to remove datalinks used by DHCP agent: %s" % err
    82             print "failed to remove datalinks used by DHCP agent: %s" % err
    70             return smf_include.SMF_EXIT_ERR_FATAL
    83             return smf_include.SMF_EXIT_ERR_FATAL
    71     return smf_include.SMF_EXIT_OK
    84     return smf_include.SMF_EXIT_OK
    72 
    85