[virt-tools-list] [PATCH 02/11] Created the KVM domain configuration class.

Darryl L. Pierce dpierce at redhat.com
Thu Apr 14 18:06:01 UTC 2011


---
 src/virtlib/__init__.py |    3 +-
 src/virtlib/config.py   |   62 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 2 deletions(-)
 create mode 100644 src/virtlib/config.py

diff --git a/src/virtlib/__init__.py b/src/virtlib/__init__.py
index b02aa4a..24b8352 100644
--- a/src/virtlib/__init__.py
+++ b/src/virtlib/__init__.py
@@ -16,5 +16,4 @@
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
 
-__all__ = ['hypervisors']
-
+__all__ = ['config']
diff --git a/src/virtlib/config.py b/src/virtlib/config.py
new file mode 100644
index 0000000..82c86cd
--- /dev/null
+++ b/src/virtlib/config.py
@@ -0,0 +1,62 @@
+# config.py - Copyright (C) 2011 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierce at redhat.com>
+#
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+class DomainConfig:
+    '''
+    Describes a domain.
+    '''
+
+    LOCAL_INSTALL = "local_install"
+    NETWORK_INSTALL = "network"
+
+    PXE_INSTALL     = "pxe"
+    INSTALL_TYPE_TEXT = {LOCAL_INSTALL   : "Local CDROM/ISO",
+                         NETWORK_INSTALL : "URL INstall Tree",
+                         PXE_INSTALL     : "PXE Install"}
+
+    INSTALL_SOURCE_CDROM = "cdrom"
+    INSTALL_SOURCE_ISO   = "iso"
+
+    NEW_STORAGE      = "new"
+    EXISTING_STORAGE = "existing"
+
+    def __init__(self):
+        self.guest_name = ""
+        self.install_type = DomainConfig.LOCAL_INSTALL
+        self.use_cdrom_source = True
+        self.install_location = ""
+        self.install_media = ""
+        self.iso_path = ""
+        self.install_url = ""
+        self.kickstart_url = ""
+        self.kernel_options = ""
+        self.os_type = "other"
+        self.os_variant = None
+        self.memory = 512
+        self.cpus = 1
+        self.enable_storage = True
+        self.use_local_storage = True
+        self.storage_size = 8.0
+        self.allocate_storage = True
+        self.storage_pool = ""
+        self.storage_volume = ""
+        self.network_bridge = None
+        self.mac_address = None
+        self.virt_type = None
+        self.architecture = None
+
-- 
1.7.4.2




More information about the virt-tools-list mailing list