Remove * import from xenserver plugins

Recently a change was made to how/where the '_' method is imported. This
seems to have broken most xenserver plugins. These plugins shouldn't be
doing * imports anyway so I've gone in and cleaned up all places where
"from pluginlib_nova import *" was used and replaced with "import
pluginlib_nova".

Fixes bug 1207107

Change-Id: I3b2a299cf60543e0f766becfeb4740af791b3576
This commit is contained in:
Brian Lamar 2013-07-31 11:03:29 -04:00
parent e263a45d6e
commit 6d3d641de5
10 changed files with 48 additions and 31 deletions

View File

@ -23,9 +23,11 @@ import time
import libtorrent import libtorrent
#FIXME(sirp): should this use pluginlib from 5.6? import pluginlib_nova
from pluginlib_nova import *
configure_logging('_bittorrent_seeder')
pluginlib_nova.configure_logging('_bittorrent_seeder')
logging = pluginlib_nova.logging
def _daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): def _daemonize(stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):

View File

@ -28,19 +28,18 @@ try:
import json import json
except ImportError: except ImportError:
import simplejson as json import simplejson as json
import os
import random
import subprocess
import tempfile
import time import time
import XenAPIPlugin import XenAPIPlugin
from pluginlib_nova import * import pluginlib_nova
configure_logging("agent") pluginlib_nova.configure_logging("agent")
import xenstore import xenstore
DEFAULT_TIMEOUT = 30 DEFAULT_TIMEOUT = 30
PluginError = pluginlib_nova.PluginError
_ = pluginlib_nova._
class TimeoutError(StandardError): class TimeoutError(StandardError):
@ -164,7 +163,8 @@ def inject_file(self, arg_dict):
def agent_update(self, arg_dict): def agent_update(self, arg_dict):
"""Expects an URL and md5sum of the contents, then directs the agent to """Expects an URL and md5sum of the contents, then directs the agent to
update itself.""" update itself.
"""
timeout = int(arg_dict.pop('timeout', DEFAULT_TIMEOUT)) timeout = int(arg_dict.pop('timeout', DEFAULT_TIMEOUT))
request_id = arg_dict["id"] request_id = arg_dict["id"]
url = arg_dict["url"] url = arg_dict["url"]

View File

@ -17,13 +17,12 @@
"""Fetch Bandwidth data from VIF network devices.""" """Fetch Bandwidth data from VIF network devices."""
import os
import shutil
import utils import utils
from pluginlib_nova import * import pluginlib_nova
configure_logging('bandwidth')
pluginlib_nova.configure_logging('bandwidth')
def _read_proc_net(): def _read_proc_net():

View File

@ -26,13 +26,15 @@ import time
import libtorrent import libtorrent
import urllib2 import urllib2
import XenAPIPlugin
import utils import utils
#FIXME(sirp): should this use pluginlib from 5.6? import pluginlib_nova
from pluginlib_nova import *
configure_logging('bittorrent')
pluginlib_nova.configure_logging('bittorrent')
logging = pluginlib_nova.logging
DEFAULT_TORRENT_CACHE = '/images/torrents' DEFAULT_TORRENT_CACHE = '/images/torrents'
DEFAULT_SEED_CACHE = '/images/seeds' DEFAULT_SEED_CACHE = '/images/seeds'

View File

@ -29,7 +29,6 @@ as will be required after a log rotate:
import base64 import base64
import logging import logging
import os
import zlib import zlib
import XenAPIPlugin import XenAPIPlugin

View File

@ -26,9 +26,12 @@ import urllib2
import utils import utils
#FIXME(sirp): should this use pluginlib from 5.6? import pluginlib_nova
from pluginlib_nova import *
configure_logging('glance')
pluginlib_nova.configure_logging('glance')
logging = pluginlib_nova.logging
PluginError = pluginlib_nova.PluginError
class RetryableError(Exception): class RetryableError(Exception):

View File

@ -26,9 +26,15 @@ import shutil
import XenAPIPlugin import XenAPIPlugin
#FIXME(sirp): should this use pluginlib from 5.6? import pluginlib_nova
from pluginlib_nova import *
configure_logging('kernel')
pluginlib_nova.configure_logging('kernel')
logging = pluginlib_nova.logging
exists = pluginlib_nova.exists
optional = pluginlib_nova.optional
with_vdi_in_dom0 = pluginlib_nova.with_vdi_in_dom0
KERNEL_DIR = '/boot/guest' KERNEL_DIR = '/boot/guest'

View File

@ -20,8 +20,11 @@ XenAPI Plugin for transferring data between host nodes
""" """
import utils import utils
from pluginlib_nova import * import pluginlib_nova
configure_logging('migration')
pluginlib_nova.configure_logging('migration')
logging = pluginlib_nova.logging
def move_vhds_into_sr(session, instance_uuid, sr_path, uuid_stack): def move_vhds_into_sr(session, instance_uuid, sr_path, uuid_stack):

View File

@ -22,9 +22,10 @@ import shutil
import utils import utils
#FIXME(sirp): should this use pluginlib from 5.6? import pluginlib_nova
from pluginlib_nova import *
configure_logging('workarounds')
pluginlib_nova.configure_logging('workarounds')
def _copy_vdis(sr_path, staging_path, vdi_uuids): def _copy_vdis(sr_path, staging_path, vdi_uuids):

View File

@ -37,6 +37,8 @@ import XenAPIPlugin
pluginlib.configure_logging("xenhost") pluginlib.configure_logging("xenhost")
_ = pluginlib._
host_data_pattern = re.compile(r"\s*(\S+) \([^\)]+\) *: ?(.*)") host_data_pattern = re.compile(r"\s*(\S+) \([^\)]+\) *: ?(.*)")
config_file_path = "/usr/etc/xenhost.conf" config_file_path = "/usr/etc/xenhost.conf"