Make _GenerateDRBD8Branch accept different VG names
[ganeti-local] / lib / constants.py
index c6adfb4..b8810d3 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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
@@ -200,7 +200,7 @@ DEV_CONSOLE = "/dev/console"
 
 PROC_MOUNTS = "/proc/mounts"
 
-# luxi related constants
+# Local UniX Interface related constants
 LUXI_EOM = "\3"
 LUXI_VERSION = CONFIG_VERSION
 
@@ -416,10 +416,18 @@ EXPORT_MODES = frozenset([
   EXPORT_MODE_REMOTE,
   ])
 
-# lock recalculate mode
+# Lock recalculate mode
 LOCKS_REPLACE = 'replace'
 LOCKS_APPEND = 'append'
 
+# Lock timeout (sum) before we should go into blocking acquire (still
+# can be reset by priority change); computed as max time (10 hours)
+# before we should actually go into blocking acquire given that we
+# start from default priority level; in seconds
+LOCK_ATTEMPTS_TIMEOUT = 10 * 3600 / 20.0
+LOCK_ATTEMPTS_MAXWAIT = 15.0
+LOCK_ATTEMPTS_MINWAIT = 1.0
+
 # instance creation modes
 INSTANCE_CREATE = "create"
 INSTANCE_IMPORT = "import"
@@ -437,8 +445,15 @@ RIE_HANDSHAKE = "Hi, I'm Ganeti"
 # Remote import/export certificate validity in seconds
 RIE_CERT_VALIDITY = 24 * 60 * 60
 
-# Remote import/export connect timeout for socat
-RIE_CONNECT_TIMEOUT = 60
+# Overall timeout for establishing connection
+RIE_CONNECT_TIMEOUT = 180
+
+# Export only: how long to wait per connection attempt (seconds)
+RIE_CONNECT_ATTEMPT_TIMEOUT = 20
+
+# Export only: number of attempts to connect
+RIE_CONNECT_RETRIES = 10
+
 #: Give child process up to 5 seconds to exit after sending a signal
 CHILD_LINGER_TIMEOUT = 5.0
 
@@ -502,7 +517,7 @@ LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
 DEFAULT_SHUTDOWN_TIMEOUT = 120
 NODE_MAX_CLOCK_SKEW = 150
 # Time for an intra-cluster disk transfer to wait for a connection
-DISK_TRANSFER_CONNECT_TIMEOUT = 30
+DISK_TRANSFER_CONNECT_TIMEOUT = 60
 # Disk index separator
 DISK_SEPARATOR = _autoconf.DISK_SEPARATOR
 
@@ -644,7 +659,7 @@ HVS_PARAMETER_TYPES = {
 
 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
 
-# BE parameter names
+# Backend parameter names
 BE_MEMORY = "memory"
 BE_VCPUS = "vcpus"
 BE_AUTO_BALANCE = "auto_balance"
@@ -769,7 +784,8 @@ HT_NIC_E1000 = "e1000"
 HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
 
 HT_HVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
-                                    HT_NIC_NE2K_ISA, HT_NIC_PARAVIRTUAL])
+                                    HT_NIC_E1000, HT_NIC_NE2K_ISA,
+                                    HT_NIC_PARAVIRTUAL])
 HT_KVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
                                     HT_NIC_NE2K_ISA, HT_NIC_I82551,
                                     HT_NIC_I85557B, HT_NIC_I8259ER,
@@ -838,6 +854,7 @@ NV_DRBDLIST = "drbd-list"
 NV_FILELIST = "filelist"
 NV_HVINFO = "hvinfo"
 NV_HYPERVISOR = "hypervisor"
+NV_HVPARAMS = "hvparms"
 NV_INSTANCELIST = "instancelist"
 NV_LVLIST = "lvlist"
 NV_MASTERIP = "master-ip"
@@ -972,7 +989,7 @@ QR_GROUP = "group"
 #: List of resources which can be queried using L{opcodes.OpQuery}
 QR_OP_QUERY = frozenset([QR_INSTANCE, QR_NODE, QR_GROUP])
 
-#: List of resources which can be queried using LUXI
+#: List of resources which can be queried using Local UniX Interface
 QR_OP_LUXI = QR_OP_QUERY.union([
   QR_LOCK,
   ])
@@ -1005,7 +1022,9 @@ RS_NORMAL = 0
 RS_UNKNOWN = 1
 #: No data (e.g. RPC error), can be used instead of L{RS_OFFLINE}
 RS_NODATA = 2
-#: Value unavailable for item
+#: Value unavailable/unsupported for item; if this field is supported
+#: but we cannot get the data for the moment, RS_NODATA or
+#: RS_OFFLINE should be used
 RS_UNAVAIL = 3
 #: Resource marked offline
 RS_OFFLINE = 4
@@ -1018,6 +1037,14 @@ RS_ALL = frozenset([
   RS_OFFLINE,
   ])
 
+#: Dictionary with special field cases and their verbose/terse formatting
+RSS_DESCRIPTION = {
+  RS_UNKNOWN: ("(unknown)", "??"),
+  RS_NODATA:  ("(nodata)",  "?"),
+  RS_OFFLINE: ("(offline)", "*"),
+  RS_UNAVAIL: ("(unavail)", "-"),
+  }
+
 # max dynamic devices
 MAX_NICS = 8
 MAX_DISKS = 16