1
0
mirror of synced 2026-04-13 23:23:41 +00:00

Added support for (optionally) setting the bridge

--bridge

Added support for setting the number of vcpus
	--vcpus
This commit is contained in:
Dmitry Nedospasov
2010-05-19 13:46:58 +02:00
parent e4eae6fcf5
commit c03029e0c6
2 changed files with 35 additions and 2 deletions

View File

@@ -137,6 +137,10 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
Install a getty on the specified serial device instead
of the default device.
--vcpus=num
Set the number of vcpus that the new instance will have
instead of the default value of "1".
Installation options:
@@ -202,6 +206,10 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--broadcast=123.456.789.ABC
Setup the broadcast address for the new instance.
--bridge=brname
Optionally, set a specific bridge for the new instance.
This can be especially useful when running multiple
bridges on a machine.
Mandatory options:
@@ -1225,6 +1233,7 @@ sub setupDefaultOptions
$CONFIG{ 'swap' } = '128M';
$CONFIG{ 'cache' } = 'yes';
$CONFIG{ 'image' } = 'sparse';
$CONFIG{ 'vcpus' } = '1';
#
# Misc. options.
@@ -1421,6 +1430,7 @@ sub parseCommandLineArguments
"noswap", \$CONFIG{ 'noswap' },
"image=s", \$CONFIG{ 'image' },
"memory=s", \$CONFIG{ 'memory' },
"vcpus=s", \$CONFIG{ 'vcpus' },
# Locations
"dir=s", \$install{ 'dir' },
@@ -1441,6 +1451,7 @@ sub parseCommandLineArguments
# Networking options
"dhcp", \$CONFIG{ 'dhcp' },
"bridge=s", \$CONFIG{ 'bridge' },
"gateway=s", \$CONFIG{ 'gateway' },
"hostname=s", \$CONFIG{ 'hostname' },
"ip=s@", \$CONFIG{ 'ip' },

View File

@@ -34,6 +34,7 @@
$OUT .= "bootloader = '$pygrub_bin'\n";
}
}
vcpus = '{$vcpus}'
memory = '{$memory}'
#
@@ -106,8 +107,22 @@ name = '{$hostname}'
{
$m = "mac=$mac"
}
$OUT .= "vif = [ '$m' ]";
my $br = '';
if ( $bridge )
{
if ( $mac )
{
$br = ",bridge=$bridge"
}
else
{
$br = "bridge=$bridge"
}
}
$OUT .= "vif = [ '";
$OUT .= "$m";
$OUT .= "$br";
$OUT .= "' ]";
}
else
{
@@ -126,9 +141,16 @@ name = '{$hostname}'
$vn = ",vifname=$vifname";
}
my $br = '';
if ( $bridge )
{
$br = ",bridge=$bridge"
}
$OUT .= "vif = [ 'ip=$ip1";
$OUT .= "$m";
$OUT .= "$vn";
$OUT .= "$br";
$OUT .= "' ]";
}
}