Commit 29a2c8f5 authored by Paul John King's avatar Paul John King

Added options to set MAC addresses --

parent 32e49c13
......@@ -51,7 +51,7 @@ create_pool(){
if test $# != 2 ;
then
print_pool_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _NAME="${1}" ;
......@@ -79,7 +79,7 @@ destroy_pool(){
if test $# != 1 ;
then
print_pool_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _NAME="${1}" ;
......@@ -114,7 +114,7 @@ create_volume(){
if test $# != 3 ;
then
print_volume_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _NAME="${1}" ;
......@@ -146,7 +146,7 @@ destroy_volume(){
if test $# != 2 ;
then
print_volume_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _NAME="${1}" ;
......@@ -181,10 +181,27 @@ print_domain_usage_message(){
create_domain(){
local OPTIND ;
local _mac_address="" ;
while getopts ":m:" OPTION ;
do
case "${OPTION}" in
"m")
_mac_address="${OPTARG}" ;
;;
"?")
echo "The command-line option '-${OPTARG}' is invalid." >&2 ;
return 1 ;
;;
esac ;
done ;
shift $(( OPTIND - 1 )) ;
if test $# != 5 ;
then
print_domain_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _DOMAIN="${1}" ;
......@@ -195,7 +212,7 @@ create_domain(){
shift 5 ;
{
echo_stdin |
echo_stdin |
virsh -q define "/dev/stdin" ;
} <<- __END_OF_STDIN__
<domain type='kvm'>
......@@ -227,7 +244,7 @@ create_domain(){
<controller type='pci' model='pci-root'/>
<controller type='ide'/>
<interface type='bridge'>
<source bridge='${_BRIDGE}'/>
<source bridge='${_BRIDGE}'/>${_mac_address:+<mac address='${_mac_address}'/>}
<model type='virtio'/>
</interface>
<serial type='pty'/>
......@@ -247,7 +264,7 @@ destroy_domain(){
if test $# != 1 ;
then
print_domain_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _DOMAIN="${1}" ;
......@@ -281,10 +298,27 @@ print_machine_usage_message(){
create_machine(){
local OPTIND ;
local _ipv4_address="" ;
while getopts ":i:" OPTION ;
do
case "${OPTION}" in
"i")
_ipv4_address="${OPTARG}" ;
;;
"?")
echo "The command-line option '-${OPTARG}' is invalid." >&2 ;
return 1 ;
;;
esac ;
done ;
shift $(( OPTIND - 1 )) ;
if test $# != 5 ;
then
print_machine_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _NAME="${1}" ;
......@@ -294,9 +328,12 @@ create_machine(){
local _BRIDGE="${5}" ;
shift 5 ;
local _path ;
create_volume "${_NAME}" "default" "${_PATH}" &&
path=$(get_image_path "${_NAME}" "default") &&
create_domain "${_NAME}" "${_CPU_COUNT}" "${_RAM}" "${_PATH}" "${_BRIDGE}" ;
_path=$(get_image_path "${_NAME}" "default") &&
create_domain${_ipv4_address:+ -m $(get_mac_address "${_ipv4_address}")} "${_NAME}" "${_CPU_COUNT}" "${_RAM}" "${_path}" "${_BRIDGE}" ;
#create_domain "${_NAME}" "${_CPU_COUNT}" "${_RAM}" "${_path}" "${_BRIDGE}" ;
}
......@@ -305,7 +342,7 @@ destroy_machine(){
if test $# != 1 ;
then
print_machine_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _NAME="${1}" ;
......@@ -334,7 +371,7 @@ get_image_path(){
if test $# != 2 ;
then
print_get_image_path_usage_message >&2 ;
exit 1 ;
return 1 ;
fi ;
local _NAME="${1}" ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment