def __init__(self, virtapi, scheme="https"): super(VMwareVCDriver, self).__init__(virtapi) if (CONF.vmware.host_ip is None or CONF.vmware.host_username is None or CONF.vmware.host_password is None): raise Exception(_("Must specify host_ip, host_username and " "host_password to use vmwareapi.VMwareVCDriver")) if CONF.vnc.keymap: LOG.warning('The option "[vnc] keymap" has been deprecated in ' 'favor of the VMWare-specific "[vmware] vnc_keymap" ' 'option. Please update nova.conf to address this ' 'change') self._datastore_regex = None if CONF.vmware.datastore_regex: try: self._datastore_regex = re.compile(CONF.vmware.datastore_regex) except re.error: raise exception.InvalidInput(reason= _("Invalid Regular Expression %s") % CONF.vmware.datastore_regex) self._session = VMwareAPISession(scheme=scheme) self._check_min_version() # Update the PBM location if necessary if CONF.vmware.pbm_enabled: self._update_pbm_location() self._validate_configuration() self._cluster_name = CONF.vmware.cluster_name self._cluster_ref = vm_util.get_cluster_ref_by_name(self._session, self._cluster_name) if self._cluster_ref is None: raise exception.NotFound(_("The specified cluster '%s' was not " "found in vCenter") % self._cluster_name) self._vcenter_uuid = self._get_vcenter_uuid() self._nodename = self._create_nodename(self._cluster_ref.value) self._volumeops = volumeops.VMwareVolumeOps(self._session, self._cluster_ref) self._vmops = vmops.VMwareVMOps(self._session, virtapi, self._volumeops, self._cluster_ref, datastore_regex=self._datastore_regex) self._vc_state = host.VCState(self._session, self._nodename, self._cluster_ref, self._datastore_regex) # Register the OpenStack extension self._register_openstack_extension()
def __init__(self, virtapi, scheme="https"): super(VMwareVCDriver, self).__init__(virtapi) if (CONF.vmware.host_ip is None or CONF.vmware.host_username is None or CONF.vmware.host_password is None): raise Exception(_("Must specify host_ip, host_username and " "host_password to use vmwareapi.VMwareVCDriver")) if CONF.vnc.keymap: LOG.warning('The option "[vnc] keymap" has been deprecated in ' 'favor of the VMWare-specific "[vmware] vnc_keymap" ' 'option. Please update nova.conf to address this ' 'change') self._datastore_regex = None if CONF.vmware.datastore_regex: try: self._datastore_regex = re.compile(CONF.vmware.datastore_regex) except re.error: raise exception.InvalidInput(reason= _("Invalid Regular Expression %s") % CONF.vmware.datastore_regex) self._session = VMwareAPISession(scheme=scheme) self._check_min_version() # Update the PBM location if necessary if CONF.vmware.pbm_enabled: self._update_pbm_location() self._validate_configuration() self._cluster_name = CONF.vmware.cluster_name self._cluster_ref = vm_util.get_cluster_ref_by_name(self._session, self._cluster_name) if self._cluster_ref is None: raise exception.NotFound(_("The specified cluster '%s' was not " "found in vCenter") % self._cluster_name) self._vcenter_uuid = self._get_vcenter_uuid() self._nodename = self._create_nodename(self._cluster_ref.value) self._volumeops = volumeops.VMwareVolumeOps(self._session, self._cluster_ref) self._vmops = vmops.VMwareVMOps(self._session, virtapi, self._volumeops, self._cluster_ref, datastore_regex=self._datastore_regex) self._vc_state = host.VCState(self._session, self._nodename, self._cluster_ref, self._datastore_regex) # Register the OpenStack extension self._register_openstack_extension()
def check_can_live_migrate_source(self, context, instance, dest_check_data, block_device_info=None): cluster_name = dest_check_data.cluster_name cluster_ref = vm_util.get_cluster_ref_by_name(self._session, cluster_name) if cluster_ref is None: msg = (_("Cannot find destination cluster %s for live migration") % cluster_name) raise exception.MigrationPreCheckError(reason=msg) res_pool_ref = vm_util.get_res_pool_ref(self._session, cluster_ref) if res_pool_ref is None: msg = _("Cannot find destination resource pool for live migration") raise exception.MigrationPreCheckError(reason=msg) return dest_check_data
def check_can_live_migrate_source(self, context, instance, dest_check_data, block_device_info=None): cluster_name = dest_check_data.cluster_name cluster_ref = vm_util.get_cluster_ref_by_name(self._session, cluster_name) if cluster_ref is None: msg = (_("Cannot find destination cluster %s for live migration") % cluster_name) raise exception.MigrationPreCheckError(reason=msg) res_pool_ref = vm_util.get_res_pool_ref(self._session, cluster_ref) if res_pool_ref is None: msg = _("Cannot find destination resource pool for live migration") raise exception.MigrationPreCheckError(reason=msg) return dest_check_data
def __init__(self, virtapi, scheme="https"): super(VMwareVCDriver, self).__init__(virtapi) if (CONF.vmware.host_ip is None or CONF.vmware.host_username is None or CONF.vmware.host_password is None): raise Exception(_("Must specify host_ip, host_username and " "host_password to use vmwareapi.VMwareVCDriver")) # Begin Pf9 change # Get the list of datastores, and convert to a regex - Pf9 UI passes this in as a comma-separated list self._datastore_regex = None ds_list = CONF.vmware.datastore_regex if ds_list: # Convert 'ds1, ds2,ds3, ds4' => 'ds1|ds2|ds3|ds4' regex_string = "|".join([item.rstrip().lstrip() for item in ds_list.split(',')]) if regex_string != '': try: self._datastore_regex = re.compile(regex_string) except re.error: raise exception.InvalidInput(reason= _("Invalid Regular Expression %s") % regex_string) self._pf9_hostid = CONF.host # End Pf9 change self._session = VMwareAPISession(scheme=scheme) self._check_min_version() # Update the PBM location if necessary if CONF.vmware.pbm_enabled: self._update_pbm_location() self._validate_configuration() self._cluster_name = CONF.vmware.cluster_name self._cluster_ref = vm_util.get_cluster_ref_by_name(self._session, self._cluster_name) if self._cluster_ref is None: raise exception.NotFound(_("The specified cluster '%s' was not " "found in vCenter") % self._cluster_name) self._vcenter_uuid = self._get_vcenter_uuid() self._nodename = self._create_nodename(self._cluster_ref.value, self._cluster_name) self._volumeops = volumeops.VMwareVolumeOps(self._session, self._cluster_ref) self._vmops = vmops.VMwareVMOps(self._session, virtapi, self._volumeops, self._cluster_ref, datastore_regex=self._datastore_regex) self._vc_state = host.VCState(self._session, self._nodename, self._cluster_ref, self._datastore_regex) # Register the OpenStack extension self._register_openstack_extension()