#!/usr/bin/python
#
-# Copyright (C) 2011 Google Inc.
+# Copyright (C) 2011, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
from ganeti import errors
from ganeti import ovf
from ganeti import utils
+from ganeti import pathutils
import testutils
"nic0_ip": "none",
"nic0_mac": "aa:00:00:d8:2c:1e",
"nic0_link": "xen-br0",
+ "nic0_network": "auto",
}
GANETI_HYPERVISOR = {
"hypervisor_name": "xen-pvm",
"nic0_ip": "none",
"nic0_link": "auto",
"nic0_mac": "auto",
+ "nic0_network": "auto",
}
VIRTUALBOX_HYPERVISOR = {"hypervisor_name": "auto"}
VIRTUALBOX_OS = {"os_name": None}
"nic0_ip": "none",
"nic0_mac": "auto",
"nic_count": "1",
+ "nic0_network": "auto",
}
CMDARGS_HYPERVISOR = {
"hypervisor_name": "xen-pvm"
},
]
EXP_NETWORKS_LIST = [
- {"mac": "aa:00:00:d8:2c:1e", "ip":"None", "link":"br0","mode":"routed"},
+ {"mac": "aa:00:00:d8:2c:1e", "ip":"None", "link":"br0",
+ "mode":"routed", "network": "test"},
]
EXP_PARTIAL_GANETI_DICT = {
"hypervisor": {"name": "xen-kvm"},
"version": "0",
}
EXP_GANETI_DICT = {
- 'tags': None,
- 'auto_balance': 'False',
- 'hypervisor': {
- 'root-path': '/dev/sda',
- 'name': 'xen-pvm',
- 'kernel_args': 'ro'
+ "tags": None,
+ "auto_balance": "False",
+ "hypervisor": {
+ "root-path": "/dev/sda",
+ "name": "xen-pvm",
+ "kernel_args": "ro"
},
- 'version': '0',
- 'disk_template': None,
- 'os': {'name': 'lenny-image'}
+ "version": "0",
+ "disk_template": None,
+ "os": {"name": "lenny-image"}
}
EXP_NAME ="xen-dev-i1"
EXP_VCPUS = 1
"Nic ovf:name=\"routed0\"><gnt:Mode>routed</gnt:"
"Mode><gnt:MACAddress>aa:00:00:d8:2c:1e</gnt:"
"MACAddress><gnt:IPAddress>None</gnt:IPAddress>"
- "<gnt:Link>br0</gnt:Link></gnt:Nic></gnt:Network>"
- "</gnt:GanetiSection>")
+ "<gnt:Link>br0</gnt:Link><gnt:Net>test</gnt:Net>"
+ "</gnt:Nic></gnt:Network></gnt:GanetiSection>")
EXPORT_GANETI = ("<gnt:GanetiSection><gnt:Version>0</gnt:Version><gnt:"
"AutoBalance>False</gnt:AutoBalance><gnt:OperatingSystem>"
"<gnt:Name>lenny-image</gnt:Name><gnt:Parameters /></gnt:"
"Hypervisor><gnt:Network><gnt:Nic ovf:name=\"routed0\"><gnt:"
"Mode>routed</gnt:Mode><gnt:MACAddress>aa:00:00:d8:2c:1e</gnt:"
"MACAddress><gnt:IPAddress>None</gnt:IPAddress><gnt:Link>br0"
- "</gnt:Link></gnt:Nic></gnt:Network></gnt:GanetiSection>")
+ "</gnt:Link><gnt:Net>test</gnt:Net></gnt:Nic></gnt:Network>"
+ "</gnt:GanetiSection>")
EXPORT_SYSTEM = ("<References><File ovf:compression=\"gzip\" ovf:href=\"new_"
"disk.cow.gz\" ovf:id=\"file0\" ovf:size=\"203\" /><File ovf:"
"href=\"new_disk.cow\" ovf:id=\"file1\" ovf:size=\"15\" />"
def testOVAUnpackingDirectories(self):
self.importer = ovf.OVFImporter(self.ova_package, OPTS_EMPTY)
self.assertTrue(self.importer.input_dir != None)
- self.assertEquals(self.importer.output_dir , constants.EXPORT_DIR)
+ self.assertEquals(self.importer.output_dir , pathutils.EXPORT_DIR)
self.assertTrue(self.importer.temp_dir != None)
def testOVFUnpackingDirectories(self):
self.importer = ovf.OVFImporter(self.virtualbox_ovf,
OPTS_EMPTY)
self.assertEquals(self.importer.input_dir , _GetFullFilename(""))
- self.assertEquals(self.importer.output_dir , constants.EXPORT_DIR)
+ self.assertEquals(self.importer.output_dir , pathutils.EXPORT_DIR)
self.assertEquals(self.importer.temp_dir , None)
def testOVFSetOutputDirDirectories(self):