Add arch to vm name, and check kernel for boot arch
This commit is contained in:
+10
-5
@@ -340,12 +340,15 @@ def makeKickstartFloppy():
|
|||||||
def archFor( filepath ):
|
def archFor( filepath ):
|
||||||
"Guess architecture for file path"
|
"Guess architecture for file path"
|
||||||
name = path.basename( filepath )
|
name = path.basename( filepath )
|
||||||
if '64' in name:
|
if 'amd64' in name or 'x86_64' in name:
|
||||||
arch = 'x86_64'
|
arch = 'x86_64'
|
||||||
elif 'i386' in name or '32' in name:
|
# Beware of version 64 of a 32-bit OS
|
||||||
|
elif 'i386' in name or '32' in name or 'x86' in name:
|
||||||
arch = 'i386'
|
arch = 'i386'
|
||||||
|
elif '64' in name:
|
||||||
|
arch = 'x86_64'
|
||||||
else:
|
else:
|
||||||
log( "Error: can't discern CPU for file name", name )
|
log( "Error: can't discern CPU for name", name )
|
||||||
exit( 1 )
|
exit( 1 )
|
||||||
return arch
|
return arch
|
||||||
|
|
||||||
@@ -412,7 +415,9 @@ def boot( cow, kernel, initrd, logfile ):
|
|||||||
# pexpect might not be installed until after depend() is called
|
# pexpect might not be installed until after depend() is called
|
||||||
global pexpect
|
global pexpect
|
||||||
import pexpect
|
import pexpect
|
||||||
arch = archFor( kernel )
|
kinfo = run( 'file ' + kernel )
|
||||||
|
# Slightly abusing archFor here
|
||||||
|
arch = archFor( kinfo )
|
||||||
if NoKVM:
|
if NoKVM:
|
||||||
accel = 'tcg'
|
accel = 'tcg'
|
||||||
else:
|
else:
|
||||||
@@ -698,7 +703,7 @@ def build( flavor='raring32server' ):
|
|||||||
vm = boot( volume, kernel, initrd, logfile )
|
vm = boot( volume, kernel, initrd, logfile )
|
||||||
version = interact( vm )
|
version = interact( vm )
|
||||||
size = qcow2size( volume )
|
size = qcow2size( volume )
|
||||||
vmdk = convert( volume, basename='mininet-vm' )
|
vmdk = convert( volume, basename='mininet-vm-' + archFor( flavor ) )
|
||||||
if not SaveQCOW2:
|
if not SaveQCOW2:
|
||||||
log( '* Removing qcow2 volume', volume )
|
log( '* Removing qcow2 volume', volume )
|
||||||
os.remove( volume )
|
os.remove( volume )
|
||||||
|
|||||||
Reference in New Issue
Block a user