[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a

Garrett Holmstrom gholms at fedoraproject.org
Sun Jun 16 02:31:20 UTC 2013


The following commit has been merged in the master branch:
commit 7f0adae68df9e7d09d64aed82a330b4c012b19ad
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Wed May 8 19:21:06 2013 -0700

    Implement ModifyInstanceType

diff --git a/bin/euca-modify-instance-type b/bin/euca-modify-instance-type
new file mode 100755
index 0000000..eecbf96
--- /dev/null
+++ b/bin/euca-modify-instance-type
@@ -0,0 +1,6 @@
+#!/usr/bin/python -tt
+
+import euca2ools.commands.euca.modifyinstancetype
+
+if __name__ == '__main__':
+    euca2ools.commands.euca.modifyinstancetype.ModifyInstanceType.run()
diff --git a/euca2ools/commands/euca/disassociateaddress.py b/euca2ools/commands/euca/modifyinstancetype.py
similarity index 51%
copy from euca2ools/commands/euca/disassociateaddress.py
copy to euca2ools/commands/euca/modifyinstancetype.py
index 88290a2..6132ec4 100644
--- a/euca2ools/commands/euca/disassociateaddress.py
+++ b/euca2ools/commands/euca/modifyinstancetype.py
@@ -1,6 +1,6 @@
 # Software License Agreement (BSD License)
 #
-# Copyright (c) 2009-2013, Eucalyptus Systems, Inc.
+# Copyright (c) 2013, Eucalyptus Systems, Inc.
 # All rights reserved.
 #
 # Redistribution and use of this software in source and binary forms, with or
@@ -31,29 +31,33 @@
 from euca2ools.commands.euca import EucalyptusRequest
 from requestbuilder import Arg
 from requestbuilder.exceptions import ArgumentError
+from requestbuilder.mixins import TabifyingMixin
 
 
-class DisassociateAddress(EucalyptusRequest):
-    DESCRIPTION = 'Disassociate an elastic IP address from an instance'
-    ARGS = [Arg('PublicIp', metavar='ADDRESS', nargs='?', help='''[Non-VPC
-                only] elastic IP address to disassociate (required)'''),
-            Arg('-a', '--association-id', dest='AssociationId',
-                metavar='ASSOC',
-                help="[VPC only] address's association ID (required)")]
+class ModifyInstanceType(EucalyptusRequest, TabifyingMixin):
+    DESCRIPTION = '[Eucalyptus cloud admin only] Modify an instance type'
+    ARGS = [Arg('Name', metavar='INSTANCETYPE',
+                help='name of the instance type to modify (required)'),
+            Arg('-c', '--cpus', dest='Cpu', metavar='COUNT', type=int,
+                help='number of virtual CPUs to allocate to each instance'),
+            Arg('-d', '--disk', dest='Disk', metavar='GB', type=int,
+                help='amount of instance storage to allow each instance'),
+            Arg('-m', '--memory', dest='Memory', metavar='MB', type=int,
+                help='amount of RAM to allocate to each instance'),
+            Arg('--reset', dest='Reset', action='store_true',
+                help='reset the instance type to its default configuration')]
 
     def configure(self):
         EucalyptusRequest.configure(self)
-        if self.args.get('PublicIp'):
-            if self.args.get('AssociationId'):
-                raise ArgumentError('argument -a/--association-id: not '
-                                    'allowed with an IP address')
-            elif self.args['PublicIp'].startswith('eipassoc'):
-                raise ArgumentError('VPC elastic IP association IDs must be '
-                                    'be specified with -a/--association-id')
-        elif not self.args.get('AssociationId'):
-            raise ArgumentError(
-                'argument -a/--association-id or an IP address is required')
+        if (self.args.get('Reset') and
+            any(self.args.get(attr) is not None for attr in ('Cpu', 'Disk',
+                                                            'Memory'))):
+            # Basically, reset is mutually exclusive with everything else.
+                raise ArgumentError('argument --reset may not be used with '
+                                    'instance type attributes')
 
     def print_result(self, result):
-        target = self.args.get('PublicIp') or self.args.get('AssociationId')
-        print self.tabify(('ADDRESS', target))
+        newtype = result.get('vmType', {})
+        print self.tabify(('INSTANCETYPE', newtype.get('name'),
+                           newtype.get('cpu'), newtype.get('memory'),
+                           newtype.get('disk')))

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list