Skip to content

Commit

Permalink
Merge pull request #107 from bkhadars/docs
Browse files Browse the repository at this point in the history
Add Docs for Image upload and import commands
  • Loading branch information
ltccci authored Jan 19, 2021
2 parents 5ee16c3 + 180eb68 commit 80ccbeb
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The typical image workflow comprises of the following steps:
- How to convert RHEL qcow2 to ova image format - [guide](docs/RHEL%20Qcow2%20to%20OVA.md)
- How to convert RHCOS(Red Hat CoreOS) qcow2 to ova image format - [guide](docs/RHCOS%20Qcow2%20to%20OVA.md)
- Advanced scenarios for Qcow2 to ova image conversion - [guide](docs/Advanced%20Scenarios%20for%20Qcow2%20to%20OVA.md)
- How to import image to PowerVS instance from COS - [guide](docs/How%20to%20Import%20Image%20to%20PowerVS%20Instance.md)
- How to upload image to COS bucket using pvsadm - [guide](docs/How%20to%20Upload%20Image%20to%20COS.md)

### Samples
Please take a look at the [samples](samples/README.md) folder for end-to-end examples.
Please take a look at the [samples](samples/README.md) folder for end-to-end examples.
57 changes: 57 additions & 0 deletions docs/How to Import Image to PowerVS Instance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Overview
This guide talks about how to import image to PowerVs instance using pvsadm.

# Prerequisite
- pvsadm tool
- IBMCLOUD_API_KEY. [How to create api key](https://cloud.ibm.com/docs/account?topic=account-userapikey#create_user_key)
- S3 BucketName, Bucket Region, ObjectName
- PowerVS Instance Name/PowerVS Instance ID.

# Image import Command help
```shell
$pvsadm image import --help
Flags:
--accesskey string Cloud Storage access key
-b, --bucket string Cloud Storage bucket name
-h, --help help for import
--image-name string Name to give imported image
-i, --instance-id string Instance ID of the PowerVS instance
-n, --instance-name string Instance name of the PowerVS
-o, --object-name string Cloud Storage image filename
--ostype string Image OS Type, accepted values are[aix, ibmi, redhat, sles] (default "redhat")
-r, --region string COS bucket location
--secretkey string Cloud Storage secret key
--service-credential-name string Service Credential name to be auto generated (default "pvsadm-service-cred")
--storagetype string Storage type, accepted values are [tier1, tier3] (default "tier3")
```

# Importing Image to PowerVS instance from S3 Bucket using pvsadm

Set the API key variable
```shell
$export IBMCLOUD_API_KEY=<IBM_CLOUD_API_KEY>
```

### case 1:
Importing the image using auto-generated s3 credential
```shell
$pvsadm image import -n <POWERVS_INSTANCE_NAME> -b <BUCKETNAME> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION>
```

### case 2:
Importing the image using accesskey and secretkey
```shell
$pvsadm image import -n <POWERVS_INSTANCE_NAME> -b <BUCKETNAME> --accesskey <ACCESSKEY> --secretkey <SECRETKEY> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION>
```

### case 3:
If user wants to specify the PowerVS storage type for importing the image
```shell
$pvsadm image import -n <POWERVS_INSTANCE_NAME> -b <BUCKETNAME> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION> --storagetype <POWERVS_STORAGE_TYPE>
```

### case 4:
If user wants to specify type of OS
```shell
$pvsadm image import -n <POWERVS_INSTANCE_NAME> -b <BUCKETNAME> --object rhel-83-10032020.ova.gz --pvs-image-name test-image -r <REGION> --ostype <OSTYPE>
```
51 changes: 51 additions & 0 deletions docs/How to Upload Image to COS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Overview
This guide talks about how to upload image file to Cloud object Storage instance using pvsadm.

# Prerequisite
- pvsadm tool
- Image file(RHEL/CENTOS/CoreOS)
- IBMCLOUD_API_KEY. [How to create api key](https://cloud.ibm.com/docs/account?topic=account-userapikey#create_user_key)

# Image upload command help:
```shell
$pvsadm image upload --help
Usage:
pvsadm image upload [flags]

Flags:
--resource-group string Name of user resource group. (default "default")
--cos-storageclass string Cloud Object Storage Class type, available values are [standard, smart, cold, vault]. (default "standard")
-n, --cos-instance-name string Cloud Object Storage instance name.
-b, --bucket string Cloud Object Storage bucket name.
-f, --file string The PATH to the file to upload.
-r, --bucket-region string Cloud Object Storage bucket region. (default "us-south")
-h, --help help for upload
```

# Image upload using pvsadm tool

Mandatory parameters for uploading the object to Cloud object storage using pvsadm tool are --bucket and --file

### case 1:
If user wants to upload the object to the bucket in the default region(us-south).
```shell
$pvsadm image upload --bucket bucket0711 -f rhcos-461.ova.gz
```

### case 2:
If bucket doesn't exists in default region(us-south), then user has to provide --bucket-region parameter to pvsadm tool.
```shell
$pvsadm image upload --bucket bucket0711 -f rhcos-461.ova.gz --bucket-region <REGION>
```

### case 3:
If user knows Cloud Object Storage Instance where bucket is created, then use --cos-instance-name
```shell
$pvsadm image upload --bucket bucket0711 -f rhcos-461.ova.gz --cos-instance-name pvsadm-cos-instance --bucket-region <REGION>
```

### case 4:
If user is planning to create a new Cloud Object Storage Instance(S3 service)
```shell
$pvsadm image upload --bucket bucket1320 -f centos-8-latest.ova.gz --resource-group <ResourceGroup_Name> --bucket-region <REGION>
```

0 comments on commit 80ccbeb

Please sign in to comment.