aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-12-15 00:03:30 +0200
committerSergey Poznyakoff <gray@gnu.org>2018-12-15 00:03:30 +0200
commit2116e1ef1cd5597e23f785e84d67d8fea5537475 (patch)
tree6b9b8c33c639a84c81c2db67b4913cd3ef89f35c
parent35c194f2f3bfe666494c62fe3a770661e3886aa6 (diff)
downloadeclat-2116e1ef1cd5597e23f785e84d67d8fea5537475.tar.gz
eclat-2116e1ef1cd5597e23f785e84d67d8fea5537475.tar.bz2
Implement ModifyVolume and DescribeVolumesModifications
-rw-r--r--TODO2
-rw-r--r--etc/Makefile.am2
-rw-r--r--etc/describe-volumes-modifications.fln49
-rw-r--r--etc/modify-volume.fln45
-rw-r--r--lib/libeclat.h2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/chvol.c86
-rw-r--r--src/eclat.c5
-rw-r--r--src/eclat.h4
-rw-r--r--src/lschvol.c68
10 files changed, 263 insertions, 2 deletions
diff --git a/TODO b/TODO
index 3e45bda..f0b5579 100644
--- a/TODO
+++ b/TODO
@@ -104,6 +104,7 @@ DescribeSpotPriceHistory - [ ] [ ]
104DescribeSubnets lssubnet [X] [ ] 104DescribeSubnets lssubnet [X] [ ]
105DescribeTags lstag [X] [X] 105DescribeTags lstag [X] [X]
106DescribeVolumes lsvol [X] [X] 106DescribeVolumes lsvol [X] [X]
107DescribeVolumesModifications lschvol [X] [ ]
107DescribeVolumeAttribute - [ ] [ ] 108DescribeVolumeAttribute - [ ] [ ]
108DescribeVolumeStatus - [ ] [ ] 109DescribeVolumeStatus - [ ] [ ]
109DescribeVpcAttribute lsvpcattr [X] [ ] 110DescribeVpcAttribute lsvpcattr [X] [ ]
@@ -129,6 +130,7 @@ ModifyInstanceAttribute setiattr [X] [X]
129ModifyNetworkInterfaceAttribute - [ ] [ ] 130ModifyNetworkInterfaceAttribute - [ ] [ ]
130ModifySnapshotAttribute setsattr [X] [X] 131ModifySnapshotAttribute setsattr [X] [X]
131ModifySubnetAttribute setsubnetattr [X] [ ] 132ModifySubnetAttribute setsubnetattr [X] [ ]
133ModifyVolume chvol [X] [ ]
132ModifyVolumeAttribute - [ ] [ ] 134ModifyVolumeAttribute - [ ] [ ]
133ModifyVpcAttribute setvpcattr [X] [ ] 135ModifyVpcAttribute setvpcattr [X] [ ]
134MonitorInstances - [ ] [ ] 136MonitorInstances - [ ] [ ]
diff --git a/etc/Makefile.am b/etc/Makefile.am
index 2376583..7d0b355 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -60,6 +60,7 @@ FLNFILES=\
60 describe-subnets.fln\ 60 describe-subnets.fln\
61 describe-tags.fln\ 61 describe-tags.fln\
62 describe-volumes.fln\ 62 describe-volumes.fln\
63 describe-volumes-modifications.fln\
63 describe-vpc-attribute.fln\ 64 describe-vpc-attribute.fln\
64 describe-vpcs.fln\ 65 describe-vpcs.fln\
65 detach-internet-gateway.fln\ 66 detach-internet-gateway.fln\
@@ -72,6 +73,7 @@ FLNFILES=\
72 modify-instance-attribute.fln\ 73 modify-instance-attribute.fln\
73 modify-snapshot-attribute.fln\ 74 modify-snapshot-attribute.fln\
74 modify-subnet-attribute.fln\ 75 modify-subnet-attribute.fln\
76 modify-volume.fln\
75 modify-vpc-attribute.fln\ 77 modify-vpc-attribute.fln\
76 reboot-instances.fln\ 78 reboot-instances.fln\
77 release-address.fln\ 79 release-address.fln\
diff --git a/etc/describe-volumes-modifications.fln b/etc/describe-volumes-modifications.fln
new file mode 100644
index 0000000..f752490
--- /dev/null
+++ b/etc/describe-volumes-modifications.fln
@@ -0,0 +1,49 @@
1/* This file is part of Eclat.
2 Copyright (C) 2018 Sergey Poznyakoff.
3
4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 Eclat is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
16
17if (.DescribeVolumesModificationsResponse.volumeModificationSet.item) {
18 for (var in .DescribeVolumesModificationsResponse.volumeModificationSet.item) {
19 print(var.volumeId,
20 " ",
21 var.modificationState,
22 " ",
23 var.progress,
24 "%\n");
25 if (var.targetSize) {
26 print("\tsize: ",
27 var.originalSize,
28 " => ",
29 var.targetSize,
30 "\n");
31 }
32 if (var.targetVolumeType) {
33 print("\ttype: ",
34 var.originalVolumeType,
35 " => ",
36 var.targetVolumeType,
37 "\n");
38 }
39 if (var.targetIops) {
40 print("\tiops:",
41 var.originalIops,
42 " => ",
43 var.targetIops,
44 "\n");
45 }
46 }
47}
48
49
diff --git a/etc/modify-volume.fln b/etc/modify-volume.fln
new file mode 100644
index 0000000..6b04bec
--- /dev/null
+++ b/etc/modify-volume.fln
@@ -0,0 +1,45 @@
1/* This file is part of Eclat.
2 Copyright (C) 2018 Sergey Poznyakoff.
3
4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 Eclat is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
16
17if (.ModifyVolumeResponse.volumeModification) {
18 print(.ModifyVolumeResponse.volumeModification.volumeId,
19 ": ",
20 .ModifyVolumeResponse.volumeModification.modificationState,
21 " ",
22 .ModifyVolumeResponse.volumeModification.progress,
23 "%\n");
24 if (.ModifyVolumeResponse.volumeModification.targetSize) {
25 print("\tsize: ",
26 .ModifyVolumeResponse.volumeModification.originalSize,
27 " => ",
28 .ModifyVolumeResponse.volumeModification.targetSize,
29 "\n");
30 }
31 if (.ModifyVolumeResponse.volumeModification.targetVolumeType) {
32 print("\ttype: ",
33 .ModifyVolumeResponse.volumeModification.originalVolumeType,
34 " => ",
35 .ModifyVolumeResponse.volumeModification.targetVolumeType,
36 "\n");
37 }
38 if (.ModifyVolumeResponse.volumeModification.targetIops) {
39 print("\tiops: ",
40 .ModifyVolumeResponse.volumeModification.originalIops,
41 " => ",
42 .ModifyVolumeResponse.volumeModification.targetIops,
43 "\n");
44 }
45} \ No newline at end of file
diff --git a/lib/libeclat.h b/lib/libeclat.h
index 6f1acf6..285e045 100644
--- a/lib/libeclat.h
+++ b/lib/libeclat.h
@@ -83,7 +83,7 @@ struct ec2_param {
83 int encoded; 83 int encoded;
84}; 84};
85 85
86#define EC2_API_VERSION "2014-06-15" 86#define EC2_API_VERSION "2016-11-15"
87 87
88#define EC2_RF_HTTPS 0x01 88#define EC2_RF_HTTPS 0x01
89#define EC2_RF_POST 0x02 89#define EC2_RF_POST 0x02
diff --git a/src/Makefile.am b/src/Makefile.am
index e78461c..c4fc211 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,7 @@ eclat_SOURCES=\
21 allocaddr.c\ 21 allocaddr.c\
22 asscaddr.c\ 22 asscaddr.c\
23 atvol.c\ 23 atvol.c\
24 chvol.c\
24 cmdline.h\ 25 cmdline.h\
25 config.c\ 26 config.c\
26 cpimg.c\ 27 cpimg.c\
@@ -39,6 +40,7 @@ eclat_SOURCES=\
39 lsaddr.c\ 40 lsaddr.c\
40 lsattr.c\ 41 lsattr.c\
41 lsaattr.c\ 42 lsaattr.c\
43 lschvol.c\
42 lsiattr.c\ 44 lsiattr.c\
43 lsimg.c\ 45 lsimg.c\
44 lsinst.c\ 46 lsinst.c\
diff --git a/src/chvol.c b/src/chvol.c
new file mode 100644
index 0000000..f1246c9
--- /dev/null
+++ b/src/chvol.c
@@ -0,0 +1,86 @@
1/* This file is part of Eclat.
2 Copyright (C) 2012-2018 Sergey Poznyakoff.
3
4 Eclat is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 Eclat is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with Eclat. If not, see <http://www.gnu.org/licenses/>. */
16
17#include "eclat.h"
18
19// eclat modvol VOLID [iops=V] [size=S] [type=V]
20
21char const *params[] = {
22 "iops",
23 "Iops",
24 "size",
25 "Size",
26 "type",
27 "VolumeType"
28};
29
30static char const *
31getparam(char const *p, size_t len)
32{
33 int i;
34
35 for (i = 0; i < sizeof(params) / sizeof(params[0]); i++) {
36 if (len == strlen(params[i])
37 && memcmp(params[i], p, len) == 0) {
38 if (i % 2 == 0)
39 i++;
40 return params[i];
41 }