mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
Rename qemu image type to qemu image format
This commit is contained in:
parent
b94a4e2308
commit
5d8c90d138
@ -1253,12 +1253,12 @@ class QemuVM(BaseVM):
|
|||||||
:returns: Image name with the extensions
|
:returns: Image name with the extensions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
img_type = options.pop("type")
|
img_format = options.pop("format")
|
||||||
img_size = options.pop("size")
|
img_size = options.pop("size")
|
||||||
img_name = "{}.{}".format(name, img_type)
|
img_name = "{}.{}".format(name, img_format)
|
||||||
|
|
||||||
qemu_img = self._get_qemu_img()
|
qemu_img = self._get_qemu_img()
|
||||||
command = [qemu_img, "create", "-f", img_type]
|
command = [qemu_img, "create", "-f", img_format]
|
||||||
for option in sorted(options.keys()):
|
for option in sorted(options.keys()):
|
||||||
command.extend(["-o", "{}={}".format(option, options[option])])
|
command.extend(["-o", "{}={}".format(option, options[option])])
|
||||||
command.append(os.path.join(self.working_dir, img_name))
|
command.append(os.path.join(self.working_dir, img_name))
|
||||||
|
@ -415,7 +415,7 @@ def test_get_qemu_img(vm, tmpdir):
|
|||||||
open(str(tmpdir / "qemu-sytem-x86_64"), "w+").close()
|
open(str(tmpdir / "qemu-sytem-x86_64"), "w+").close()
|
||||||
open(str(tmpdir / "qemu-img"), "w+").close()
|
open(str(tmpdir / "qemu-img"), "w+").close()
|
||||||
vm._qemu_path = str(tmpdir / "qemu-sytem-x86_64")
|
vm._qemu_path = str(tmpdir / "qemu-sytem-x86_64")
|
||||||
assert vm._get_qemu_img() == str(tmpdir / "qemu-img")
|
assert vm._get_qemu_img() == str(tmpdir / "qemu-img")
|
||||||
|
|
||||||
|
|
||||||
def test_get_qemu_img_not_exist(vm, tmpdir):
|
def test_get_qemu_img_not_exist(vm, tmpdir):
|
||||||
@ -428,7 +428,7 @@ def test_get_qemu_img_not_exist(vm, tmpdir):
|
|||||||
|
|
||||||
def test_create_image(vm, loop, fake_qemu_img_binary):
|
def test_create_image(vm, loop, fake_qemu_img_binary):
|
||||||
options = {
|
options = {
|
||||||
"type": "qcow2",
|
"format": "qcow2",
|
||||||
"preallocation": "metadata",
|
"preallocation": "metadata",
|
||||||
"cluster_size": 64,
|
"cluster_size": 64,
|
||||||
"refcount_bits": 12,
|
"refcount_bits": 12,
|
||||||
|
Loading…
Reference in New Issue
Block a user