Useful commands and scripts
This appendix provides some useful commands and scripts.
This appendix covers the following topics:
Useful openstack commands
This section includes some commands that you might find useful.
Adding a user to access the IBM Power Virtualization Center graphical user interface instead of root
The following commands enable a user to access the IBM Power Virtualization Center (IBM PowerVC) graphical user interface (GUI). You most likely want to change the password to something much more secure.
# adduser IBM PowerVC -p SECRET
# source /opt/ibm/IBM PowerVC/IBM PowerVCrc
# export OS_USERNAME=root
# export OS_PASSWORD=SECRET
# openstack role add --project ibm-default --user IBM PowerVC admin
Adding and listing a project
To create a project and list it, run the following commands:
# openstack project create --description "Six Project" six
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | Six Project |
| domain_id | default |
| enabled | True |
| id | 4e5ed9491daf44319eab573ebd0825e6 |
| is_domain | False |
| name | six |
| parent_id | default |
+-------------+----------------------------------+
# openstack project list
+----------------------------------+-------------+
| ID | Name |
+----------------------------------+-------------+
| 135537788461455183a90a4886142a65 | powervm |
| 1f0ca545a81a4fffa8af6cf5fd2bea91 | ibm-default |
| 4e5ed9491daf44319eab573ebd0825e6 | six |
| aa0ed38f28154f0aaac3c0e60decfb65 | service |
+----------------------------------+-------------+
Creating users and roles for access to a project
You can create users and add roles to them in Version 1.3.1 by running the following commands. You might want to use a more secure password.
# adduser sixadmin -p SECRET
# adduser halfdozen -p SECRET
#
# openstack role add --project six --user sixadmin admin
# openstack role add --project six --user halfdozen admin
# openstack user list
+--------------------------+-------------------+
| ID | Name |
+--------------------------+-------------------+
. . .
| 1dd45dfca1d83b0e38 . . . | IBM PowerVC |
| 79d13683f8ab37b1d5 . . . | sixadmin |
| 897db369914c6109c4 . . . | halfdozen |
+--------------------------+-------------------+
Changing a role
Perhaps you need to change a role after you discover that a user is not an administrator. To do so, run the following commands:
# openstack role remove --project six --user halfdozen admin
# openstack role add --project six --user halfdozen deployer
Useful IBM PowerVC-config commands
This section is a quick reference to several commands.
The following command finds the current settings with example output from IBM PowerVC V1.3.1.1 on RHEL7.1 BE on POWER8. Most of the settings are the default values except the network ones. Adding -h after the command shows you how to set the same variable.
The following command can be used to set the network domain as follows as the root user:
# /usr/bin/IBM PowerVC-config compute server-domain --set ats.uk.ibm.com
The default domain name was updated for the specified hosts. Verify that no tasks are in-progress, then run the '/opt/ibm/IBM PowerVC/bin/IBM PowerVC-services nova restart' command to restart the nova services and complete the operation.
General subcommands
Here are general IBM PowerVC-config subcommands.
Listing an interface configuration
To list an interface configuration, run the following command:
# IBM PowerVC-config general ifconfig
IBM PowerVC IP version : 4
IBM PowerVC management address: vm17.ats.uk.ibm.com
IBM PowerVC hostname: vm17
ifconfig Change the hostname or IP address of the IBM PowerVC controller
Listing an IP address
To list an IP address, run the following command:
# IBM PowerVC-config general ipaddress
Current value: 9.137.62.17
ipaddress The IP address of the IBM PowerVC controller Warning: This option will be deprecated in future releases.
Listing a host name
To list a host name, run the following command:
# IBM PowerVC-config general hostname
Current value: vm17
hostname The hostname of the IBM PowerVC controller Warning: This option will be deprecated in future releases.
Identify subcommands
The following commands are identify subcommands for the IBM PowerVC-config command.
Listing a token expiration
To list a token expiration, run the following command:
# IBM PowerVC-config identity token_expiration
Current value: 6:00:00
Default value: 6:00:00
token_expiration Configure the expiration interval for the identity token
The output is in Hours:Minutes:Seconds format.
Listing a repository
To list a repository, run the following command:
# IBM PowerVC-config identity repository
IBM PowerVC is configured for operating system authentication.
repository Configure the repository for authentication credentials, for example an LDAP server.
 
[root@vm17 ~]# IBM PowerVC-config image image_size_cap
Current value: 1099511627776 B
Default value: 1099511627776 B
image_size_cap Configure the maximum image size, which can be uploaded through IBM PowerVC controller
Image subcommand
# IBM PowerVC-config image user_storage_quota
Current value: 0 B
Default value: 0 B
user_storage_quota Configure the maximum amount of per-user image storage.
Storage subcommand
# IBM PowerVC-config storage portgroup
usage: IBM PowerVC-config storage portgroup [-h] --arrayid ArrayID [--portgroup PortGroup] [--add] [--remove] [--list] [--restart]
portgroup Configure the EMC VMAX PortGroup list
Compute subcommand
# IBM PowerVC-config compute server-domain
[global] ats.uk.ibm.com
828642A_100DC7V ats.uk.ibm.com
8408E8E_21A494V ats.uk.ibm.com
828422A_215E96V ats.uk.ibm.com
9117MMB_100C25P ats.uk.ibm.com
8231E2B_06FA44P ats.uk.ibm.com
8231E1C_0659GDR ats.uk.ibm.com
8233E8B_100W72P ats.uk.ibm.com
8233E8B_100S71P ats.uk.ibm.com
server-domain Display or set the default virtual machine domain name
Metering subcommands
The following commands are useful subcommands to display the metering in your IBM PowerVC environment.
metering_ttl
# IBM PowerVC-config metering meter_ttl
Current value: 14 days, 0:00:00
Default value: 14 days, 0:00:00
meter_ttl Configure the time to live interval for the meter data.
event_ttl
# IBM PowerVC-config metering event_ttl
Current value: 270 days, 0:00:00
Default value: 270 days, 0:00:00
event_ttl Configure the time to live interval for the event data.
Web subcommands
The following subcommands control inactivity time outs and password prompts.
inactivity_timeout
# IBM PowerVC-config web inactivity_timeout
Current value: 2:00:00
Default value: 2:00:00
inactivity_timeout Time that UI users will be allowed to idle before being prompted and logged out. Value 0 or less will disable the timer.
token_expiration_warning_time
# IBM PowerVC-config web token_expiration_warning_time
Current value: 0:15:00
Default value: 0:15:00
token_expiration_warning_time Time before token expiration to prompt user for password to obtain new token. Value 0 or less will disable the timer.
Useful scripts
The scripts that are provided in this section format output as report quality output.
Listing the defined projects and user assignments
To list the projects and users that are defined, use the openstack role assignment list command. A script is helpful to align the output into something more readable.
 
Note:
The -f option stops TTY style output.
The -c column-name option selects what is output.
The --name option removes the hexadecimal D and provides the names (note the double "-").
Removing the @Service lines removes internal users.
By project, role, and user name
A simple script produces list quality output from the openstack command:
# openstack role assignment list -c Project -c Role -c User --names -f value
| grep -v @Service | sed 's/@Default//g' |
awk '{ printf "%-15s %-15s %-15s ", $3, $1, $2 }' | sort
eight admin eightadmin
eight admin nig
eight admin IBM PowerVC
eight deployer eightdep
eight self_service eightself
eight self_service scotts
ibm-default admin nig
ibm-default admin IBM PowerVC
ibm-default admin root
ibm-default self_service scotts
seven admin nig
seven admin IBM PowerVC
seven admin sevenadmin
seven deployer sevendep
seven self_service scotts
seven self_service powrpro
seven self_service sevenself
six admin nig
six admin IBM PowerVC
six admin sixadmin
six deployer halfdozen
six self_service scotts
six self_service sixtine
six self_service sixtus
By user name, project, and role
A simple script produces list quality output from the openstack command.
# openstack role assignment list -c Project -c Role -c User --names -f value
 
| grep -v @Service | sed 's/@Default//g' |
awk '{ printf "%-15s %-15s %-15s ", $2, $3, $1 }' | sort
eightadmin eight admin
eightdep eight deployer
eightself eight self_service
halfdozen six deployer
scotts eight self_service
scotts ibm-default self_service
scotts seven self_service
scotts six self_service
nig eight admin
nig ibm-default admin
nig seven admin
nig six admin
IBM PowerVC eight admin
IBM PowerVC ibm-default admin
IBM PowerVC seven admin
IBM PowerVC six admin
root ibm-default admin
powrpro seven self_service
sevenadmin seven admin
sevendep seven deployer
sevenself seven self_service
sixadmin six admin
sixtine six self_service
sixtus six self_service
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset