Esempio n. 1
0
    def get_instance_dir(self, instance_name, remote_server=None,
                         create_dir=True, remove_dir=False):
        instance_dir = self._get_instances_sub_dir(
            instance_name, remote_server,
            create_dir=False, remove_dir=False)

        # In some situations, the instance files may reside at a different
        # location than the configured one.
        if not os.path.exists(instance_dir):
            vmutils = (self._vmutils if not remote_server
                       else utilsfactory.get_vmutils(remote_server))
            try:
                instance_dir = vmutils.get_vm_config_root_dir(
                    instance_name)
                if remote_server:
                    instance_dir = self._get_remote_unc_path(remote_server,
                                                             instance_dir)
                LOG.info(_LI("Found instance dir at non-default location: %s"),
                         instance_dir)
            except os_win_exc.HyperVVMNotFoundException:
                pass

        self._check_dir(instance_dir,
                        create_dir=create_dir,
                        remove_dir=remove_dir)
        return instance_dir
Esempio n. 2
0
 def __init__(self):
     self._diskutils = utilsfactory.get_diskutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._vmutils = utilsfactory.get_vmutils()
     self._vmops = vmops.VMOps()
     self._api = api.API()
Esempio n. 3
0
 def __init__(self):
     self._livemigrutils = utilsfactory.get_livemigrationutils()
     self._pathutils = pathutils.PathUtils()
     self._vmops = vmops.VMOps()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._vmutils = utilsfactory.get_vmutils()
Esempio n. 4
0
 def __init__(self):
     self._livemigrutils = utilsfactory.get_livemigrationutils()
     self._pathutils = pathutils.PathUtils()
     self._vmops = vmops.VMOps()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._vmutils = utilsfactory.get_vmutils()
Esempio n. 5
0
    def get_instance_dir(self,
                         instance_name,
                         remote_server=None,
                         create_dir=True,
                         remove_dir=False):
        instance_dir = self._get_instances_sub_dir(instance_name,
                                                   remote_server,
                                                   create_dir=False,
                                                   remove_dir=False)

        # In some situations, the instance files may reside at a different
        # location than the configured one.
        if not os.path.exists(instance_dir):
            vmutils = (self._vmutils if not remote_server else
                       utilsfactory.get_vmutils(remote_server))
            try:
                instance_dir = vmutils.get_vm_config_root_dir(instance_name)
                if remote_server:
                    instance_dir = self._get_remote_unc_path(
                        remote_server, instance_dir)
                LOG.info(_LI("Found instance dir at non-default location: %s"),
                         instance_dir)
            except os_win_exc.HyperVVMNotFoundException:
                pass

        self._check_dir(instance_dir,
                        create_dir=create_dir,
                        remove_dir=remove_dir)
        return instance_dir
Esempio n. 6
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._default_root_device = 'vda'
     self.volume_drivers = {
         constants.STORAGE_PROTOCOL_SMBFS: SMBFSVolumeDriver(),
         constants.STORAGE_PROTOCOL_ISCSI: ISCSIVolumeDriver(),
         constants.STORAGE_PROTOCOL_FC: FCVolumeDriver()}
Esempio n. 7
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._volutils = utilsfactory.get_iscsi_initiator_utils()
     self._initiator = None
     self._default_root_device = 'vda'
     self.volume_drivers = {'smbfs': SMBFSVolumeDriver(),
                            'iscsi': ISCSIVolumeDriver()}
Esempio n. 8
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._volutils = utilsfactory.get_iscsi_initiator_utils()
     self._initiator = None
     self._default_root_device = 'vda'
     self.volume_drivers = {'smbfs': SMBFSVolumeDriver(),
                            'iscsi': ISCSIVolumeDriver()}
Esempio n. 9
0
 def __init__(self):
     self._diskutils = utilsfactory.get_diskutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._vmutils = utilsfactory.get_vmutils()
     self._vmops = vmops.VMOps()
     self._api = api.API()
Esempio n. 10
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._vmops = vmops.VMOps()
     self._imagecache = imagecache.ImageCache()
     self._block_dev_man = block_device_manager.BlockDeviceInfoManager()
Esempio n. 11
0
    def __init__(self, host='.'):
        super(MetricsUtils, self).__init__(host)
        self._metrics_svc_obj = None
        self._metrics_defs_obj = {}

        # We need to avoid a circular dependency.
        from os_win import utilsfactory
        self._vmutils = utilsfactory.get_vmutils(host)
Esempio n. 12
0
 def __init__(self):
     self._hostutils = utilsfactory.get_hostutils()
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._vmops = vmops.VMOps()
     self._imagecache = imagecache.ImageCache()
Esempio n. 13
0
 def __init__(self):
     self._hostutils = utilsfactory.get_hostutils()
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._vmops = vmops.VMOps()
     self._imagecache = imagecache.ImageCache()
Esempio n. 14
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._vmops = vmops.VMOps()
     self._imagecache = imagecache.ImageCache()
     self._block_dev_man = block_device_manager.BlockDeviceInfoManager()
Esempio n. 15
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._default_root_device = 'vda'
     self.volume_drivers = {
         constants.STORAGE_PROTOCOL_SMBFS: SMBFSVolumeDriver(),
         constants.STORAGE_PROTOCOL_ISCSI: ISCSIVolumeDriver(),
         constants.STORAGE_PROTOCOL_FC: FCVolumeDriver()
     }
Esempio n. 16
0
 def __init__(self):
     self._livemigrutils = utilsfactory.get_livemigrationutils()
     self._pathutils = pathutils.PathUtils()
     self._vmops = vmops.VMOps()
     self._volumeops = volumeops.VolumeOps()
     self._serial_console_ops = serialconsoleops.SerialConsoleOps()
     self._imagecache = imagecache.ImageCache()
     self._vmutils = utilsfactory.get_vmutils()
     self._block_dev_man = block_device_manager.BlockDeviceInfoManager()
Esempio n. 17
0
    def __init__(self, state_change_callback=None, running_state_callback=None):
        self._vmutils = utilsfactory.get_vmutils()
        self._listener = self._vmutils.get_vm_power_state_change_listener(
            timeframe=CONF.hyperv.power_state_check_timeframe, filtered_states=self._TRANSITION_MAP.keys()
        )

        self._polling_interval = CONF.hyperv.power_state_event_polling_interval
        self._state_change_callback = state_change_callback
        self._running_state_callback = running_state_callback
Esempio n. 18
0
 def __init__(self):
     self._livemigrutils = utilsfactory.get_livemigrationutils()
     self._pathutils = pathutils.PathUtils()
     self._vmops = vmops.VMOps()
     self._volumeops = volumeops.VolumeOps()
     self._serial_console_ops = serialconsoleops.SerialConsoleOps()
     self._imagecache = imagecache.ImageCache()
     self._vmutils = utilsfactory.get_vmutils()
     self._block_dev_man = block_device_manager.BlockDeviceInfoManager()
Esempio n. 19
0
    def __init__(self, state_change_callback=None):
        self._vmutils = utilsfactory.get_vmutils()
        self._listener = self._vmutils.get_vm_power_state_change_listener(
            timeframe=CONF.hyperv.power_state_check_timeframe,
            event_timeout=CONF.hyperv.power_state_event_polling_interval,
            filtered_states=list(self._TRANSITION_MAP.keys()),
            get_handler=True)

        self._serial_console_ops = serialconsoleops.SerialConsoleOps()
        self._state_change_callback = state_change_callback
Esempio n. 20
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._vif_driver = None
     self._load_vif_driver_class()
     self._vm_log_writers = {}
Esempio n. 21
0
    def __init__(self, state_change_callback=None,
                 running_state_callback=None):
        self._vmutils = utilsfactory.get_vmutils()
        self._listener = self._vmutils.get_vm_power_state_change_listener(
            timeframe=CONF.hyperv.power_state_check_timeframe,
            filtered_states=list(self._TRANSITION_MAP.keys()))

        self._polling_interval = CONF.hyperv.power_state_event_polling_interval
        self._state_change_callback = state_change_callback
        self._running_state_callback = running_state_callback
Esempio n. 22
0
    def __init__(self, state_change_callback=None):
        self._vmutils = utilsfactory.get_vmutils()
        self._listener = self._vmutils.get_vm_power_state_change_listener(
            timeframe=CONF.hyperv.power_state_check_timeframe,
            event_timeout=CONF.hyperv.power_state_event_polling_interval,
            filtered_states=list(self._TRANSITION_MAP.keys()),
            get_handler=True)

        self._serial_console_ops = serialconsoleops.SerialConsoleOps()
        self._state_change_callback = state_change_callback
Esempio n. 23
0
    def __init__(self):
        self._default_root_device = 'vda'

        self._hostutils = utilsfactory.get_hostutils()
        self._vmutils = utilsfactory.get_vmutils()

        self._verify_setup()
        self.volume_drivers = {'smbfs': SMBFSVolumeDriver(),
                               'iscsi': ISCSIVolumeDriver(),
                               'fibre_channel': FCVolumeDriver()}
Esempio n. 24
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._vif_driver = None
     self._load_vif_driver_class()
     self._vm_log_writers = {}
Esempio n. 25
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._metricsutils = utilsfactory.get_metricsutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._serial_console_ops = serialconsoleops.SerialConsoleOps()
     self._vif_driver = None
     self._load_vif_driver_class()
Esempio n. 26
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._metricsutils = utilsfactory.get_metricsutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._serial_console_ops = serialconsoleops.SerialConsoleOps()
     self._vif_driver = None
     self._load_vif_driver_class()
Esempio n. 27
0
    def __init__(self):
        self._clustutils = utilsfactory.get_clusterutils()
        self._vmutils = utilsfactory.get_vmutils()
        self._clustutils.check_cluster_state()
        self._instance_map = {}

        self._this_node = hostops.HostOps.get_hostname()

        self._context = context.get_admin_context()
        self._network_api = network.API()
        self._vmops = vmops.VMOps()
        self._serial_console_ops = serialconsoleops.SerialConsoleOps()
Esempio n. 28
0
    def __init__(self):
        self._default_root_device = 'vda'

        self._hostutils = utilsfactory.get_hostutils()
        self._vmutils = utilsfactory.get_vmutils()

        self._verify_setup()
        self.volume_drivers = {
            'smbfs': SMBFSVolumeDriver(),
            'iscsi': ISCSIVolumeDriver(),
            'fibre_channel': FCVolumeDriver()
        }
Esempio n. 29
0
    def __init__(self):
        # Live migration is supported starting from Hyper-V Server 2012
        if utilsfactory.get_hostutils().check_min_windows_version(6, 2):
            self._livemigrutils = utilsfactory.get_livemigrationutils()
        else:
            self._livemigrutils = None

        self._pathutils = pathutils.PathUtils()
        self._vmops = vmops.VMOps()
        self._volumeops = volumeops.VolumeOps()
        self._imagecache = imagecache.ImageCache()
        self._vmutils = utilsfactory.get_vmutils()
Esempio n. 30
0
    def __init__(self):
        # Live migration is supported starting from Hyper-V Server 2012
        if utilsfactory.get_hostutils().check_min_windows_version(6, 2):
            self._livemigrutils = utilsfactory.get_livemigrationutils()
        else:
            self._livemigrutils = None

        self._pathutils = pathutils.PathUtils()
        self._vmops = vmops.VMOps()
        self._volumeops = volumeops.VolumeOps()
        self._imagecache = imagecache.ImageCache()
        self._vmutils = utilsfactory.get_vmutils()
Esempio n. 31
0
 def __init__(self, virtapi=None):
     self._virtapi = virtapi
     self._vmutils = utilsfactory.get_vmutils()
     self._metricsutils = utilsfactory.get_metricsutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._serial_console_ops = serialconsoleops.SerialConsoleOps()
     self._block_dev_man = (block_device_manager.BlockDeviceInfoManager())
     self._vif_driver = vif_utils.HyperVVIFDriver()
 def __init__(self, virtapi=None):
     self._virtapi = virtapi
     self._vmutils = utilsfactory.get_vmutils()
     self._metricsutils = utilsfactory.get_metricsutils()
     self._vhdutils = utilsfactory.get_vhdutils()
     self._hostutils = utilsfactory.get_hostutils()
     self._pathutils = pathutils.PathUtils()
     self._serial_console_ops = serialconsoleops.SerialConsoleOps()
     self._volumeops = volumeops.VolumeOps()
     self._imagecache = imagecache.ImageCache()
     self._vif_driver_cache = {}
     self._block_device_manager = (
         block_device_manager.BlockDeviceInfoManager())
Esempio n. 33
0
    def __init__(self):
        self._clustutils = utilsfactory.get_clusterutils()
        self._vmutils = utilsfactory.get_vmutils()
        self._clustutils.check_cluster_state()
        self._instance_map = {}

        self._daemon = None
        self._this_node = self._clustutils.get_node_name()

        self._context = context.get_admin_context()
        self._network_api = network.API()
        self._vmops = vmops.VMOps()
        self._serial_console_ops = serialconsoleops.SerialConsoleOps()
Esempio n. 34
0
    def __init__(self, instance_name):
        self._vmutils = utilsfactory.get_vmutils()
        self._pathutils = pathutils.PathUtils()

        self._instance_name = instance_name
        self._log_path = self._pathutils.get_vm_console_log_paths(
            self._instance_name)[0]

        self._client_connected = None
        self._input_queue = None
        self._output_queue = None

        self._serial_proxy = None
        self._workers = []
Esempio n. 35
0
    def __init__(self, instance_name):
        self._vmutils = utilsfactory.get_vmutils()
        self._pathutils = pathutils.PathUtils()

        self._instance_name = instance_name
        self._log_path = self._pathutils.get_vm_console_log_paths(
            self._instance_name)[0]

        self._client_connected = None
        self._input_queue = None
        self._output_queue = None

        self._serial_proxy = None
        self._workers = []
Esempio n. 36
0
def get_hypervisor_vms(host='.'):
    nova_vms = []
    other_vms = []

    try:
        vmutils = utilsfactory.get_vmutils(host=host)
        vm_mappings = vmutils.list_instance_notes()
    except Exception as ex:
        print("WARNING: Could not get hypervisor vms: %s" % host)
        return nova_vms, other_vms

    for vm_name, notes in vm_mappings:
        if notes and uuidutils.is_uuid_like(notes[0]):
            nova_vms.append(notes[0])
        else:
            other_vms.append(vm_name)

    return nova_vms, other_vms
Esempio n. 37
0
def check_vm_states(hv_names):
    vm_state_map = collections.defaultdict(int)
    group_state_map = collections.defaultdict(int)

    for node_name in hv_names:
        try:
            vmutils = utilsfactory.get_vmutils(host=node_name)
            for vm_name in vmutils.list_instances():
                state = vmutils.get_vm_state(vm_name)
                vm_state_map[state] += 1

                if clusterutils and clusterutils.vm_exists(vm_name):
                    state_info = clusterutils.get_cluster_group_state_info(vm_name)
                    group_state_map[state_info['state']] += 1
        except Exception as ex:
            print("WARNING: Could not get hypervisor vms: %s" % node_name)

    # For now, we'll just print the amount of vms/groups
    # that are currently in a specific state.
    print("VM state map: %s" % pretty_dict(vm_state_map))
    print("Group state map: %s" % pretty_dict(group_state_map))
Esempio n. 38
0
 def __init__(self):
     self._conn = None
     self._diskutils = utilsfactory.get_diskutils()
     self._vmutils = utilsfactory.get_vmutils()
     self._migrutils = utilsfactory.get_migrationutils()
    def __init__(self):
        self._volops = volumeops.VolumeOps()
        self._pathutils = pathutils.PathUtils()

        self._vmutils = utilsfactory.get_vmutils()
Esempio n. 40
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._volutils = utilsfactory.get_iscsi_initiator_utils()
Esempio n. 41
0
 def __init__(self):
     self._conn = None
     self._diskutils = utilsfactory.get_diskutils()
     self._vmutils = utilsfactory.get_vmutils()
     self._migrutils = utilsfactory.get_migrationutils()
Esempio n. 42
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._volutils = utilsfactory.get_iscsi_initiator_utils()
Esempio n. 43
0
 def __init__(self):
     super(PathUtils, self).__init__()
     self._smbutils = utilsfactory.get_smbutils()
     self._vmutils = utilsfactory.get_vmutils()
Esempio n. 44
0
 def __init__(self):
     self._smbutils = utilsfactory.get_smbutils()
     self._vmutils = utilsfactory.get_vmutils()
     self._username_regex = re.compile(r'user(?:name)?=([^, ]+)')
     self._password_regex = re.compile(r'pass(?:word)?=([^, ]+)')
Esempio n. 45
0
 def __init__(self):
     self._hostops = hostops.HostOps()
     self._vmutils = utilsfactory.get_vmutils()
     self._rdpconsoleutils = utilsfactory.get_rdpconsoleutils()
    def __init__(self):
        self._vmops_prop = None

        self._vmutils = utilsfactory.get_vmutils()
        self._pathutils = pathutils.PathUtils()
Esempio n. 47
0
 def __init__(self):
     self._pathutils = pathutils.PathUtils()
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
Esempio n. 48
0
 def __init__(self):
     self._hostops = hostops.HostOps()
     self._vmutils = utilsfactory.get_vmutils()
     self._rdpconsoleutils = utilsfactory.get_rdpconsoleutils()
Esempio n. 49
0
 def __init__(self):
     self._pathutils = pathutils.PathUtils()
     self._vmutils = utilsfactory.get_vmutils()
     self._vhdutils = utilsfactory.get_vhdutils()
Esempio n. 50
0
 def __init__(self):
     super(PathUtils, self).__init__()
     self._smbutils = utilsfactory.get_smbutils()
     self._vmutils = utilsfactory.get_vmutils()
Esempio n. 51
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._diskutils = utilsfactory.get_diskutils()
Esempio n. 52
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._diskutils = utilsfactory.get_diskutils()
Esempio n. 53
0
 def __init__(self):
     self._pathutils = utilsfactory.get_pathutils()
     self._vmutils = utilsfactory.get_vmutils()
     self._username_regex = re.compile(r'user(?:name)?=([^, ]+)')
     self._password_regex = re.compile(r'pass(?:word)?=([^, ]+)')
Esempio n. 54
0
 def __init__(self):
     self._vmutils = utilsfactory.get_vmutils()
     self._volutils = utilsfactory.get_iscsi_initiator_utils()
     self._initiator = None
     self._default_root_device = "vda"
     self.volume_drivers = {"smbfs": SMBFSVolumeDriver(), "iscsi": ISCSIVolumeDriver()}