Exemple #1
0
 def get_body_ext(self):
     """
     create vm with image, extend uds info
     :return:
     """
     super(VmCreateWithUdsImage, self).get_body_ext()
     self._vm_create_body['s3Config'] = {
         'serverIp': self.usd_image_server_ip,
         'port': self.usd_image_port,
         'accessKey': crypt.decrypt(constant.CONF.fusioncompute.uds_access_key),
         'secretKey': crypt.decrypt(constant.CONF.fusioncompute.uds_secret_key),
         'bucketName': self.usd_image_bucket_name,
         'key': self.usd_image_key
     }
Exemple #2
0
    def parse_uri(self, pieces):
        """
            swift+https://account:user:[email protected]/container/obj
        """
        self.scheme = pieces.scheme
        if pieces.scheme == "swift+https":
            self.scheme = "https"
        else:
            self.scheme = "http"

        netloc = pieces.netloc
        path = pieces.path.lstrip('/')

        try:
            cred, netloc = netloc.split('@')
            cred = urllib.unquote(cred)
            self.tenant, self.user, self.key = cred.split(':')
            self.key = crypt.decrypt(self.key)
            path_parts = path.split('/')
            self.obj = path_parts.pop()
            self.container = path_parts.pop()
            path_parts.insert(0, netloc)
            self.auth_url = self.scheme + '://' + '/'.join(path_parts)
        except:
            LOG.exception("Fail to parse the direct_url.")
            raise
    def parse_uri(self, pieces):
        """
            swift+https://account:user:[email protected]/container/obj
        """
        self.scheme = pieces.scheme
        if pieces.scheme == "swift+https":
            self.scheme = "https"
        else:
            self.scheme = "http"

        netloc = pieces.netloc
        path = pieces.path.lstrip('/')

        try:
            cred, netloc = netloc.split('@')
            cred = urllib.unquote(cred)
            self.tenant, self.user, self.key = cred.split(':')
            self.key = crypt.decrypt(self.key)
            path_parts = path.split('/')
            self.obj = path_parts.pop()
            self.container = path_parts.pop()
            path_parts.insert(0, netloc)
            self.auth_url = self.scheme + '://' + '/'.join(path_parts)
        except:
            LOG.exception("Fail to parse the direct_url.")
            raise
Exemple #4
0
    def __init__(self, virtapi):
        LOG.info(_('begin to init FusionComputeDriver ...'))
        super(FusionComputeDriver, self).__init__(virtapi)

        self._client = FCBaseClient(
            constant.CONF.fusioncompute.fc_ip,
            constant.CONF.fusioncompute.fc_user,
            crypt.decrypt(constant.CONF.fusioncompute.fc_pwd),
            constant.FC_DRIVER_JOINT_CFG['user_type'],
            ssl=True,
            port=constant.FC_DRIVER_JOINT_CFG['fc_port'],
            api_version=constant.FC_DRIVER_JOINT_CFG['api_version'],
            request_time_out=constant.FC_DRIVER_JOINT_CFG['request_time_out'])
        self._client.set_default_site()

        # task ops is need by other ops, init it first
        self.task_ops = taskops.TaskOperation(self._client)
        FC_MGR.set_client(self._client)

        self.network_ops = networkops.NetworkOps(self._client, self.task_ops)
        self.volume_ops = volumeops.VolumeOps(self._client, self.task_ops)
        self.cluster_ops = fc_cluster.ClusterOps(self._client, self.task_ops)
        self.compute_ops = computeops.ComputeOps(self._client, self.task_ops,
                                                 self.network_ops,
                                                 self.volume_ops,
                                                 self.cluster_ops)
Exemple #5
0
    def __init__(self, virtapi):
        LOG.info(_("begin to init FusionComputeDriver ..."))
        super(FusionComputeDriver, self).__init__(virtapi)

        self._client = FCBaseClient(
            constant.CONF.fusioncompute.fc_ip,
            constant.CONF.fusioncompute.fc_user,
            crypt.decrypt(constant.CONF.fusioncompute.fc_pwd),
            constant.FC_DRIVER_JOINT_CFG["user_type"],
            ssl=True,
            port=constant.FC_DRIVER_JOINT_CFG["fc_port"],
            api_version=constant.FC_DRIVER_JOINT_CFG["api_version"],
            request_time_out=constant.FC_DRIVER_JOINT_CFG["request_time_out"],
        )
        self._client.set_default_site()

        # task ops is need by other ops, init it first
        self.task_ops = taskops.TaskOperation(self._client)
        FC_MGR.set_client(self._client)

        self.network_ops = networkops.NetworkOps(self._client, self.task_ops)
        self.volume_ops = volumeops.VolumeOps(self._client, self.task_ops)
        self.cluster_ops = fc_cluster.ClusterOps(self._client, self.task_ops)
        self.compute_ops = computeops.ComputeOps(
            self._client, self.task_ops, self.network_ops, self.volume_ops, self.cluster_ops
        )
Exemple #6
0
 def __init__(self, host_ip=CONF.vmware.host_ip,
              host_port=CONF.vmware.host_port,
              username=CONF.vmware.host_username,
              password=CONF.vmware.host_password,
              retry_count=CONF.vmware.api_retry_count,
              scheme="https"):
     self._plugins = None
     password = crypt.decrypt(password)
     super(VMwareAPISession, self).__init__(
             host=host_ip,
             port=host_port,
             server_username=username,
             server_password=password,
             api_retry_count=retry_count,
             task_poll_interval=CONF.vmware.task_poll_interval,
             scheme=scheme,
             create_session=True,
             wsdl_loc=CONF.vmware.wsdl_location
             )
 def decrypt_uri(self, uri, has_quoted=True):
     old_uri = uri
     uri = ''.join(uri)
     start = uri.find(":")
     if uri[0:start] not in ['uds', 'uds+https']:
         raise webob.exc.HTTPForbidden(
             explanation='we can only copy images stored in uds')
     if start != -1:
         start = uri.find(":", start + 1)
         if start != -1:
             end = uri.rfind("@")
             if end != -1:
                 password = uri[start + 1:end]
                 if has_quoted:
                     password = urllib.unquote(password)
                 password = crypt.decrypt(password)
                 if has_quoted:
                     password = urllib.quote(password)
                 uri = uri[:start + 1] + password + uri[end:]
                 LOG.debug(
                     "[ENCRYPT-P-W-D] The uri has been decypted and return.")
                 return uri
Exemple #8
0
def decrypt(data):
    return crypt.decrypt(data)
Exemple #9
0
def decrypt(data):
    return crypt.decrypt(data)