add image format option
This commit is contained in:
parent
0e667b5262
commit
aaf0114df1
2 changed files with 7 additions and 1 deletions
|
@ -30,6 +30,7 @@ arg_parser.add_argument('--list-vms', action='store_true')
|
||||||
arg_parser.add_argument('--memory', help="Size of memory (GB)", type=int)
|
arg_parser.add_argument('--memory', help="Size of memory (GB)", type=int)
|
||||||
arg_parser.add_argument('--cores', help="Amount of CPU cores", type=int)
|
arg_parser.add_argument('--cores', help="Amount of CPU cores", type=int)
|
||||||
arg_parser.add_argument('--image', help="Path (under hackprefix) to OS image")
|
arg_parser.add_argument('--image', help="Path (under hackprefix) to OS image")
|
||||||
|
arg_parser.add_argument('--image-format', help="Image format: qcow2 or raw", choices=['raw', 'qcow2'])
|
||||||
arg_parser.add_argument('--uuid', help="VM UUID")
|
arg_parser.add_argument('--uuid', help="VM UUID")
|
||||||
|
|
||||||
arg_parser.add_argument('--no-db', help="Disable connection to etcd. For local testing only!", action='store_true')
|
arg_parser.add_argument('--no-db', help="Disable connection to etcd. For local testing only!", action='store_true')
|
||||||
|
|
|
@ -59,18 +59,23 @@ class VM(object):
|
||||||
self.uuid = self.config.arguments['uuid']
|
self.uuid = self.config.arguments['uuid']
|
||||||
self.memory = self.config.arguments['memory'] or '1024M'
|
self.memory = self.config.arguments['memory'] or '1024M'
|
||||||
self.cores = self.config.arguments['cores'] or 1
|
self.cores = self.config.arguments['cores'] or 1
|
||||||
|
|
||||||
if self.config.arguments['image']:
|
if self.config.arguments['image']:
|
||||||
self.image = os.path.join(self.hackprefix, self.config.arguments['image'])
|
self.image = os.path.join(self.hackprefix, self.config.arguments['image'])
|
||||||
else:
|
else:
|
||||||
self.image = None
|
self.image = None
|
||||||
|
|
||||||
|
if self.config.arguments['image_format']:
|
||||||
|
self.image_format=self.config.arguments['image_format']
|
||||||
|
else:
|
||||||
|
self.image_format='qcow2'
|
||||||
|
|
||||||
# External components.
|
# External components.
|
||||||
self.vmm = VMM(vmm_backend=self.hackprefix)
|
self.vmm = VMM(vmm_backend=self.hackprefix)
|
||||||
self.mac = MAC(self.config)
|
self.mac = MAC(self.config)
|
||||||
|
|
||||||
# Harcoded & generated values.
|
# Harcoded & generated values.
|
||||||
self.owner = 'uncoud'
|
self.owner = 'uncoud'
|
||||||
self.image_format='qcow2'
|
|
||||||
self.accel = 'kvm'
|
self.accel = 'kvm'
|
||||||
self.threads = 1
|
self.threads = 1
|
||||||
self.ifup = os.path.join(self.hackprefix, "ifup.sh")
|
self.ifup = os.path.join(self.hackprefix, "ifup.sh")
|
||||||
|
|
Loading…
Reference in a new issue