¡@

Home 

OpenStack Study: utilsfactory.py

OpenStack Index

**** CubicPower OpenStack Study ****

def _get_class(v1_class, v2_class, force_v1_flag):

    # V2 classes are supported starting from Hyper-V Server 2012 and

    # Windows Server 2012 (kernel version 6.2)

    if not force_v1_flag and get_hostutils().check_min_windows_version(6, 2):

        cls = v2_class

    else:

        cls = v1_class

    LOG.debug("Loading class: %(module_name)s.%(class_name)s",

              {'module_name': cls.__module__, 'class_name': cls.__name__})

    return cls

**** CubicPower OpenStack Study ****

def get_vmutils(host='.'):

    return _get_class(vmutils.VMUtils, vmutilsv2.VMUtilsV2,

                      CONF.hyperv.force_hyperv_utils_v1)(host)

**** CubicPower OpenStack Study ****

def get_vhdutils():

    return _get_class(vhdutils.VHDUtils, vhdutilsv2.VHDUtilsV2,

                      CONF.hyperv.force_hyperv_utils_v1)()

**** CubicPower OpenStack Study ****

def get_networkutils():

    return _get_class(networkutils.NetworkUtils,

                      networkutilsv2.NetworkUtilsV2,

                      CONF.hyperv.force_hyperv_utils_v1)()

**** CubicPower OpenStack Study ****

def get_hostutils():

    return hostutils.HostUtils()

**** CubicPower OpenStack Study ****

def get_pathutils():

    return pathutils.PathUtils()

**** CubicPower OpenStack Study ****

def get_volumeutils():

    return _get_class(volumeutils.VolumeUtils, volumeutilsv2.VolumeUtilsV2,

                      CONF.hyperv.force_volumeutils_v1)()

**** CubicPower OpenStack Study ****

def get_livemigrationutils():

    return livemigrationutils.LiveMigrationUtils()

**** CubicPower OpenStack Study ****

def get_rdpconsoleutils():

    return _get_class(rdpconsoleutils.RDPConsoleUtils,

                      rdpconsoleutilsv2.RDPConsoleUtilsV2,

                      CONF.hyperv.force_hyperv_utils_v1)()